Welcome Guest, Not a member yet? Register   Sign In
Activerecord - getting totalnumber of query when limit is used
#9

[eluser]ELRafael[/eluser]
[quote author="Zacharias" date="1189714033"]I'd still say SQL_CALC_FOUND_ROWS is to be prefered (if you have MySQL).
Code:
// just add SQL_CALC_FOUND_ROWS after SELECT and run whatever query you want
SELECT SQL_CALC_FOUND_ROWS * FROM tbl_name WHERE category = 'foo' LIMIT 10, 20

// then run this to find out how many rows have been found.
SELECT FOUND_ROWS()
However, I do think this is exclusive to MySQL.[/quote]

It's a solution, but you broke the idea of active record.....


Messages In This Thread
Activerecord - getting totalnumber of query when limit is used - by El Forum - 09-13-2007, 12:06 PM



Theme © iAndrew 2016 - Forum software by © MyBB