存在的记忆

后台常用SQL查询(三)

查询某个时间段,规格值为空的数据

SELECT o.id,o.order_number,o.order_status,o.addtime,op.id,op.product_id from nr_order o LEFT JOIN nr_order_product op ON o.main_id = op.product_id and o.id = op.order_id where o.addtime > '2018-08-17 00:00:00' and product_id is null;

2018-09-04数据未入库查询

SELECT * FROM nr_order WHERE main_id='748398825' and befrom='native'

SELECT * FROM nr_order WHERE order_number='XM809040152078338';

SELECT date format(addtim,'%y-%m-%d'),max(id)-min(id)+1,count(*) FROM nr_order
WHERE addtime>'2018-09-01' GROUP BY DATE_FORMAT(addtime,'%y-%m-%d')

select order_number,orderid from nr_order_source  where order_number not in(select order_number from nr_order) limit 10;


select count(*),order_number,orderid from nr_order_source  where orderid not in(select id from nr_order) limit 5000;

SELECT * FROM `nr_order_source` where addtime like "%2018-09-04%" and server_source not in ("tt-cache: [gii2]cache3","tt-cache: [gii2]cache5")

当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »