phpSensei Posted October 13, 2007 Share Posted October 13, 2007 What if i had a table with a bunch of data (e.g. Items, Price, Views)... I want to order the coloumns by the most viewed with the LIMIT of 30. Now, I want to give out awards for the items that belong in the 30 most viewed list. I have a "?id=1" from the url and i want a query to check if that id belongs in the 30 most viewed items... how? Quote Link to comment Share on other sites More sharing options...
trq Posted October 13, 2007 Share Posted October 13, 2007 SELECT items FROM tbl WHERE id = 1 && id IN(SELECT id FROM tbl ORDER BY view DESC LIMIT 30); If this fails to return a result then id number 1 is NOT in the top 30. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.