select count(*) from (SELECT count(*) FROM goods AS g WHERE 1=1 group by catid ) a直接执行 SELECT count(*) FROM goods AS g WHERE 1=1 group by catid 后再执行: select found_rows();
select found_rows(); 请问这个怎么使用,
$sql='SELECT count(*) FROM ecs_goods AS g WHERE 1=1 group by cat_id '; $result=$GLOBALS['db']->query($sql); 请问往下如何执行可以行到总数的值
把$sql= 这样写吧:select count(*) from (SELECT count(*) FROM goods AS g WHERE 1=1 group by catid ) a
SELECT count(*) FROM goods AS g WHERE 1=1 group by catid limit @page,@page+size
SELECT count(*) FROM goods AS g WHERE 1=1 group by catid
后再执行:
select found_rows();
请问这个怎么使用,
$result=$GLOBALS['db']->query($sql);
请问往下如何执行可以行到总数的值
这样写吧:select count(*) from (SELECT count(*) FROM goods AS g WHERE 1=1 group by catid ) a