Quote:
Originally Posted by cooldude7
this is the original query and it throws whole data,
$result = mysql_query("SELECT content.*, content_views.views AS views FROM content, content_views WHERE content_views.content = content.record_num AND content.approved = 2 AND content.enabled = 1 ORDER BY encoded_date");
so i want to limit the values from column record_num from say 1 to 20k.
record_num is kind of index so i can limit the output .
how do i do this ?
thanks for your time. 
|
LIMIT is used to grab "pages" of data..
SELECT content.*, content_views.views AS views FROM content, content_views WHERE content_views.content = content.record_num AND content.approved = 2 AND content.enabled = 1 ORDER BY encoded_date
LIMIT 0,1000
LIMIT 0,1000 - get the first 1000 entries
LIMIT 1000,1000 - get the 2nd set of 1000 entries
LIMIT 2000,1000 - get the 3rd set of 1000 entries
If you don't use LIMIT, then really, you're ORDER BY has no meaning.