How to randomly select one value per group-by column?

2007-01-12 Thread Paul B van den Berg
pers_id What would like is something like: select pers_id, random_select(odate) from t group by pers_id Does anyone know how to do this? Cheers, Paul -- Paul B van den Berg, Manager InterAction database, http://www.iadb.nl Dept of Social Pharmacy, Pharmacoepidemiology and Pharmacotherapeutics

Re: How to get machine independent unique id??

2006-06-02 Thread Paul B van den Berg
tral database. > The easiest way, without any replication setup, might be to give all your client databases a unique database_id. Then in your central database database_id.client_transaction_id is guaranteed unique. Regards, Paul -- Paul B van den Berg, Manager InterAction database, ht

Re: Help with a tricky/impossible query...

2005-04-14 Thread Paul B van den Berg
On Thu, 14 Apr 2005 11:57:50 +0100 "Andrew Braithwaite" <[EMAIL PROTECTED]> wrote: > Thanks for the idea, > > Unfortunately I can't do that as the ranges involved are unknown and > will be from 1 to several billion at lease. I can't have another table > that needs to be augmented each time my ra

Help with a tricky/impossible query...

2005-04-14 Thread Paul B van den Berg
Hi, In SQL you need to define the data that you want to work with: create table z ( z int(5) not null primary key); insert into z values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15),(16),(17),(18),(19),(20),(21),(22); If you need more values you could use a simple perl loo

Re: Deleting Duplicate Records

2003-07-31 Thread Paul B van den Berg
To select records only once try something like select * from your_table group by field1, field2, .. Regards, Paul Kim Mackey wrote: > Group, > > I have been working on a project for a while now trying to figure out > how to remove duplicate records from a single table using a query. To

Re: Mysql SELECT IF()

2002-06-19 Thread Paul B van den Berg
On 18 Jun 2002 at 16:36, Walter D. Funk wrote: > Hi everybody! > > I need to count the ACTIVE users of my Mysql users table; where 'active' is > a flag showing this status, > using the following query it returns all the user in the table, and I need > only those who have tha flag active set to '