sql随笔

Posted 一生不过烟花

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql随笔相关的知识,希望对你有一定的参考价值。

select c1.`pid` ,count(*) as num
from `user_contact` as c1
where c1.`uid` in
(select a2.`user_id` as num from `order_orderlistrow` as a1
INNER JOIN `order_orderlist` as a2 on a1.`order_orderlist_id` = a2.`id`
INNER JOIN `user` as a3 on a2.`user_id` = a3.`id`
where a1.`goods_good_id` = ‘64‘ and a2.`state` <> ‘0‘ and a2.`updatetime` > 1551369600 and a2.`updatetime` < 1554017391
group by a2.`user_id`
)
GROUP BY c1.`pid`
ORDER BY num desc

以上是关于sql随笔的主要内容,如果未能解决你的问题,请参考以下文章

Oracle随笔

sql 随笔1 substr和instr

sql随笔

Linq学习随笔三------LINQ to SQL

sql 随笔更新

SQL入门随笔(上机实验报告)