上个月的第一天: select date_sub(date_sub(date_format(now(),'%y-%m-%d'),interval extract( day from now())-1 day),interval 1 month)上个月的最后一天:select date_sub(date_sub(date_format(now(),'%y-%m-%d'),interval extract( day from now()) day),interval 0 month) as...【阅读全文】
//搜索 $start_time = strtotime($start_date); $end_time = strtotime($end_date); $sql = "select a.*,b.order_amount,b.money_paid from ".$ecs->table('invoice')." as a ". " left join ".$ecs->table('order_info')." as b on a.order_id=b.order_sn". ...【阅读全文】
最近在做项目的过程中发现了一个问题数据库表 test 有个字段是 target_id int(11),这个字段可能为零使用如下查询select * from test where target_id = '';select * from test where target_id = 'abcd';这样,所有target_id = 0 的结果都会出来,为什么?查阅资料,这是类型转化导致的,在mysql中 0 &n...【阅读全文】