From: Dan Nelson Date: January 4 2007 2:09am Subject: Re: mysql question regarding distinct/group by... List-Archive: http://lists.mysql.com/mysql/204189 Message-Id: <20070104020914.GK46561@dan.emsphone.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In the last episode (Jan 03), bruce said: > i've asked something similar before.. but it appears something is going > wrong... so, back to basics... > > i have the following test tbl. > > dog > fooID int > size int > id int > > dog > fooID size id > 1 2 1 > 2 5 2 > 1 5 3 > > if i do a query > select * from dog where fooID='1'; > > i get > 1,2,1 > 1,5,3 > > how can i do a distinct/group by select such that if i do a select on > fooID=1, i'll only get '1,2,1', or '1,5,3', meaning that i don't get both of > the items where fooId=1. How about just asking for the first matching record with LIMIT 1? -- Dan Nelson dnelson@stripped