随笔分类 - mysql
摘要:thinkphp5示例: //子查询主要的在MAX(create_time) $subQuery = Db::table('fa_crm_record') ->field('customer_id,MAX(create_time) AS create_time') ->group('customer
阅读全文
摘要:如果你的表是按年份命名的,例如 table_2021, table_2022, table_2023, table_2024, table_2025,你可以考虑使用分区查询来优化查询性能 SELECT * FROM table_2021 UNION ALL SELECT * FROM table_2
阅读全文
摘要:<?php //根据日期来统计所消耗的点数 //模型的使用方法 $result = $model ->field("id,FROM_UNIXTIME(createtime,'%Y-%m-%d') as `createtime`,sum(price) as count_price") ->group(
阅读全文

浙公网安备 33010602011771号