XpertWorlock Posted October 3, 2010 Share Posted October 3, 2010 Hi, was wondering if it is possible to count all the rows in a table, but only query let's say the first 20 results. Currently I have to do two queries. One counting all the rows and one getting the information and limiting it to 20. Is this possible? Link to comment https://forums.phpfreaks.com/topic/215048-count-number-of-rows-but-only-return-a-number-of-results/ Share on other sites More sharing options...
fenway Posted October 5, 2010 Share Posted October 5, 2010 I think you're asking for the row count without the LIMIT clause -- not without any clauses -- and if so, SQL_CALC_FOUND_ROWS is your friend. Link to comment https://forums.phpfreaks.com/topic/215048-count-number-of-rows-but-only-return-a-number-of-results/#findComment-1119259 Share on other sites More sharing options...
XpertWorlock Posted October 5, 2010 Author Share Posted October 5, 2010 That is exactly what I wanted, I figured with this many years of SQL that there had to be a way. Thanks Link to comment https://forums.phpfreaks.com/topic/215048-count-number-of-rows-but-only-return-a-number-of-results/#findComment-1119305 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.