mysql - 哪位大神能把这句sql用mongodb写出来啊?
phpcn_u1582
phpcn_u1582 2017-06-30 09:54:02
0
1
1098
SELECT COUNT(DISTINCT(ccc)) AS ccc,COUNT(DISTINCT(bbb)) AS bbb FROM total WHERE user_id='$user_id' AND ADDDATE BETWEEN '$time[starttime]' AND '$endtime' GROUP BY aaa ORDER BY aaa DESC

sql语句如上,哪位大神指点一下。

phpcn_u1582
phpcn_u1582

Antworte allen(1)
typecho

考虑使用MongoDB的aggregation:

1、COUNT(DISTINCT(ccc)) AS ccc,COUNT(DISTINCT(bbb)) AS bbb

$group+$sum

2、user_id='$user_id' AND ADDDATE BETWEEN '$time[starttime]' AND '$endtime'

$match

供参考。

Love MongoDB!Have fun!

Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!