vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Is there a way to know how many rows were used in a computation? I tried this 'trick' but I still get 1, when I know that there are 3 rows used... SELECT SQL_CALC_FOUND_ROWS MAX(DATE_ADD('2007-10-18 18:04:45', INTERVAL user_access_hours HOUR)), MAX(access_expire) FROM end_user_groups JOIN end_user_group_links ON gid = id WHERE enabled = 1 AND uid = 16; select FOUND_ROWS(); <http://dev.mysql.com/doc/refman/5.0/en/select.html> <http://dev.mysql.com/doc/refman/5.0/...html#function_ found-rows> |
| ||||
| Hi, Daevid Vincent wrote: > Is there a way to know how many rows were used in a computation? > > I tried this 'trick' but I still get 1, when I know that there are 3 rows > used... > > SELECT SQL_CALC_FOUND_ROWS > MAX(DATE_ADD('2007-10-18 18:04:45', INTERVAL user_access_hours > HOUR)), > MAX(access_expire) > FROM > end_user_groups > JOIN end_user_group_links ON gid = id > WHERE > enabled = 1 AND uid = 16; > You can use COUNT(*). FOUND_ROWS() works a little differently, as you know -- it lets you know how many rows would have been returned without a LIMIT. But this query has no LIMIT of course. > select FOUND_ROWS(); > > > <http://dev.mysql.com/doc/refman/5.0/en/select.html> > <http://dev.mysql.com/doc/refman/5.0/...html#function_ > found-rows> > > |