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 Gold Sponsor - CFHosting.net
http://www.cfhosting.net

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:187474
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

Reply via email to