Jump to content

SQL Query Problem ( How do I make this Query )


CptnChainsaw

Recommended Posts

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 :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.