Re: [GENERAL] (un)grouping question

2008-01-28 Thread Tonkuma
Don't this satisfy your requirement? (This isn't tested. There may be some syntax error.) DELETE FROM your_table T WHERE uid > (SELECT MIN(uid) FROM your_table M WHERE M.somevalue = T.somevalue ) ; The result I expected is: SELECT * FROM your_table; uid|somevalue

Re: [GENERAL] (un)grouping question

2008-01-22 Thread Rhys Stewart
Great, this does the trick thanks!! um... somevalue+random() is a simplified version of what I really wanted to do, i just wante the general idea of what the query would look like. 2008/1/21, Andrei Kovalevski <[EMAIL PROTECTED]>: > > May be this is what you need: > > select > test.uid, coa

Re: [GENERAL] (un)grouping question

2008-01-21 Thread Reece Hart
On Mon, 2008-01-21 at 22:05 +0200, Andrei Kovalevski wrote: > How can you garantee that "somevalue + random()" won't duplicate other > unique values in this column? ;) Like the inane memo from the boss says, "expect the unexpected" and "tell me all the unpredictable issues that will happen". If u

Re: [GENERAL] (un)grouping question

2008-01-21 Thread Andrei Kovalevski
Jeff Davis wrote: On Mon, 2008-01-21 at 14:25 -0500, Rhys Stewart wrote: ok, let me clarify, dont want to remove them just want them changed but need to keep the uid. However, I would like just one somevalue to remain the same. so for example, uids, 2,4 and 8 have somevalue 44, after i would

Re: [GENERAL] (un)grouping question

2008-01-21 Thread Andrei Kovalevski
May be this is what you need: select test.uid, coalesce(t.somevalue + a.max + t.uid, test.somevalue) from test left outer join (select * from test where (uid, somevalue) not in (select min(uid), somevalue from test group by somevalue) ) t on (test.uid = t.uid), (

Re: [GENERAL] (un)grouping question

2008-01-21 Thread Jeff Davis
On Mon, 2008-01-21 at 14:25 -0500, Rhys Stewart wrote: > ok, let me clarify, dont want to remove them just want them changed > but need to keep the uid. However, I would like just one somevalue to > remain the same. so for example, uids, 2,4 and 8 have somevalue 44, > after i would like 2 to remain

Re: [GENERAL] (un)grouping question

2008-01-21 Thread Scott Marlowe
On Jan 21, 2008 1:45 PM, Scott Marlowe <[EMAIL PROTECTED]> wrote: > On Jan 21, 2008 11:36 AM, Rhys Stewart <[EMAIL PROTECTED]> wrote: > > Hi list, > > > > have the following table > > > > uid|somevalue > > > > 1|11 > > 2|44 > > 3|31 > > 4|44 > > 5|71 > > 6|33 > > 7|33 > > 8|44

Re: [GENERAL] (un)grouping question

2008-01-21 Thread Scott Marlowe
On Jan 21, 2008 11:36 AM, Rhys Stewart <[EMAIL PROTECTED]> wrote: > Hi list, > > have the following table > > uid|somevalue > > 1|11 > 2|44 > 3|31 > 4|44 > 5|71 > 6|33 > 7|33 > 8|44 > 9|14 > > would like to remove the duplicate values in the column somevalue. doing > this by ju

Re: [GENERAL] (un)grouping question

2008-01-21 Thread Rhys Stewart
ok, let me clarify, dont want to remove them just want them changed but need to keep the uid. However, I would like just one somevalue to remain the same. so for example, uids, 2,4 and 8 have somevalue 44, after i would like 2 to remain 44 but uids 4 and 8 would be changed. 2008/1/21, Jeff Davis <[

Re: [GENERAL] (un)grouping question

2008-01-21 Thread Jeff Davis
On Mon, 2008-01-21 at 12:36 -0500, Rhys Stewart wrote: > Hi list, > > have the following table > > uid|somevalue > > 1|11 > 2|44 > 3|31 > 4|44 > 5|71 > 6|33 > 7|33 > 8|44 > 9|14 > > would like to remove the duplicate values in the column somevalue. > doing this by just addin

Re: [GENERAL] (un)grouping question

2008-01-21 Thread Reece Hart
On Mon, 2008-01-21 at 12:36 -0500, Rhys Stewart wrote: > uid|somevalue > > 1|11 > 2|44 > 3|31 > 4|44 > 5|71 > 6|33 > 7|33 > 8|44 > 9|14 > > would like to remove the duplicate values in the column somevalue. > doing this by just adding a random number is perfectly fine, howev

[GENERAL] (un)grouping question

2008-01-21 Thread Rhys Stewart
Hi list, have the following table uid|somevalue 1|11 2|44 3|31 4|44 5|71 6|33 7|33 8|44 9|14 would like to remove the duplicate values in the column somevalue. doing this by just adding a random number is perfectly fine, however i want to retain at least one of the original