I see where you are going with this but the sub query only returns 2 numbers, so the main query will still return only 2 lines will it not.
How about this, is there any way for DISTINCT to ignore a column (specifically the ID collumn) as I would be ok ignoring items with identical descriptions but they will of course have diferent ID's. I need... SELECT DISTINCT ID,ISBN,Description But for it to work more like SELECT DISTINCT(ISBN,Description),ID Any ideas on that? -- Jay -----Original Message----- From: Nathan Mische [mailto:[EMAIL PROTECTED] Sent: 13 December 2004 22:44 To: CF-Talk Subject: RE: Limiting SQL Results If you are using MySQL 4.1 you may be able to do something like: SELECT i1.ID, i1.ISBN FROM ISBN i1 WHERE i1.ID IN ( SELECT i2.ID FROM ISBN i2 WHERE i2.ISBN = i1.ISBN LIMIT 2 ) I don't use MySQL so your mileage may vary. --Nathan >-----Original Message----- >From: James Smith [mailto:[EMAIL PROTECTED] >Sent: Monday, December 13, 2004 9:00 AM >To: CF-Talk >Subject: Limiting SQL Results > >Ok, heres the thing. I have a table (actually multiple tables joined >but for simplicity here we will call it one table) that looks something >like... > >ID ISBN >-- ---- > 1 1 > 2 1 > 3 1 > 4 1 > 5 2 > 6 2 > 7 2 > 8 3 > 9 4 >10 4 >11 4 >12 1 >13 5 > >In the results I need no more than 2 of any ISBN, so for the above data >I need the results of the query to look like... > >ID ISBN >-- ---- > 1 1 > 2 1 > 5 2 > 6 2 > 8 3 > 9 4 >10 4 >13 5 > >The rest of thae data is irelevent, I don't care which two are >returned. > >I am using MySQL on 2k3 server. > >Any help on the SQL here? > >-- >Jay > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Special thanks to the CF Community Suite Silver Sponsor - New Atlanta http://www.newatlanta.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:187520 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54