回复:[CPHPUG:77] 看看这个sql语句的写法是否有问题

0 views
Skip to first unread message

莫不静好

unread,
Jul 13, 2009, 11:27:31 PM7/13/09
to cphpug
应该没问题.
但是建议不要用count(*) 用SQL_CALC_FOUND_ROWS吧.
 
 
------------------ 原始邮件 ------------------
发件人: "wanglei"<bwan...@hotmail.com>;
发送时间: 2009年7月14日(星期二) 上午10:52
收件人: "cphpug"<cph...@googlegroups.com>;
主题: [CPHPUG:77] 看看这个sql语句的写法是否有问题
 
$count_query = "select count(*) as `count` from `articles_category` where date_format(`post_time`,'%m') = '".$month_m."' and date_format(`post_time`,'%y') = '".($year_y)."'";

mysql数据库,where后面是否可以直接date_format()来格式化这个当前这个表的列值?还是要用 子SELECT语句?



wanglei

unread,
Jul 14, 2009, 2:10:43 AM7/14/09
to cph...@googlegroups.com
SQL_CALC_FOUND_ROWS还是第一次看到,多谢。
Reply all
Reply to author
Forward
0 new messages