Re: Workaround for distinct?

2006-12-15 Thread Brian Dunning
The table structure is in my original post. On Dec 14, 2006, at 11:49 AM, Rolando Edwards wrote: Just change your table name and you are all set. If you have the table structure, send it and I'll make the query if you want. -- MySQL General Mailing List For list archives: http://lists.my

Re: Workaround for distinct?

2006-12-14 Thread Rolando Edwards
>, Dwalu Z. Khasu <[EMAIL PROTECTED]> Sent: Thursday, December 14, 2006 12:34:05 PM GMT-0500 US/Eastern Subject: Re: Workaround for distinct? This works also select min(A.id) id,A.color from color_table A left join color_table B on A.color=B.color group by A.color order by rand(); -

Re: Workaround for distinct?

2006-12-14 Thread Rolando Edwards
TECTED]>, mysql@lists.mysql.com, Chris Boget <[EMAIL PROTECTED]> Sent: Thursday, December 14, 2006 12:30:02 PM GMT-0500 US/Eastern Subject: Re: Workaround for distinct? Here onoe that should work. It only uses a LEFT JOIN It does not use Subqueries It does not use DISTINCT Here it is

Re: Workaround for distinct?

2006-12-14 Thread Brian Dunning
do Edwards <[EMAIL PROTECTED]>, Brian Dunning <[EMAIL PROTECTED]>, mysql@lists.mysql.com Sent: Thursday, December 14, 2006 12:17:30 PM GMT-0500 US/Eastern Subject: Re: Workaround for distinct? On Thu, 14 Dec 2006, Chris Boget wrote: =>>I tried this out this morning on MySQL 5. =>

Re: Workaround for distinct?

2006-12-14 Thread Rolando Edwards
iginal Message - From: Dwalu Z. Khasu <[EMAIL PROTECTED]> To: Chris Boget <[EMAIL PROTECTED]> Cc: Rolando Edwards <[EMAIL PROTECTED]>, Brian Dunning <[EMAIL PROTECTED]>, mysql@lists.mysql.com Sent: Thursday, December 14, 2006 12:17:30 PM GMT-0500 US/Eastern Subject: Re: Wo

Re: Workaround for distinct?

2006-12-14 Thread Dwalu Z. Khasu
On Thu, 14 Dec 2006, Chris Boget wrote: =>>I tried this out this morning on MySQL 5. =>> It works. Please try this in MySQL 4 and see. => =>Unless I'm way off, I do not believe your solution will work in 4.x because =>it doesn't support sub-queries... => 4.1 does. See http://dev.mysql.com/doc/re

Re: Workaround for distinct?

2006-12-14 Thread Chris Boget
I tried this out this morning on MySQL 5. It works. Please try this in MySQL 4 and see. Unless I'm way off, I do not believe your solution will work in 4.x because it doesn't support sub-queries... thnx, Chris -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql

Re: Workaround for distinct?

2006-12-14 Thread Rolando Edwards
om (select min(id) id,color from color_table group by color) A order by rand(); select A.id,A.color from (select min(id) id,color from color_table group by color) A order by rand(); Give It A Try !!! ----- Original Message - From: Brian Dunning <[EMAIL PROTECTED]> To: mysql@lists.mysql.com

Workaround for distinct?

2006-12-14 Thread Brian Dunning
+++ | id | color | +++ | 1 | red| | 2 | blue | | 3 | red| | 4 | yellow | | 5 | yellow | | 6 | blue | | .. | ...| I'm trying to select 5 random records, but no more than 1 of any given color. According to the notes in the documentation and to my o