Jump to content


Photo

SQL Query Problem ( How do I make this Query )


  • Please log in to reply
No replies to this topic

#1 CptnChainsaw

CptnChainsaw
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 28 June 2003 - 04:45 PM

Anyone know how I can get the maximum ID for the first two records from a table where the categoryID = \"SomeValue\"?

In the example below if the categoryID = 5 then the maximum ID is 4 as I just want the first two records. How would I do this in SQL using MySQL?


//Example ( I just put the dots in to make it clearer )

ID....CategoryID.......Product_Name
3..............5.....................Fridge
4..............5....................Cooker
7..............5.............Microwave Oven
8..............5....................Freezer
9..............8.................DVD Player
10............8..................Computer


Cheers for any advice,

CptnChainsaw :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users