已有表1、表2,要求表2中,符合表1Date1与date2之间的个数
SELECT T1.C AS [客户],T1.D1 AS [DATE],T1.D2 AS [DATE2],COUNT(T2.C)AS [联系次数] FROM T1
LEFT JOIN T2 ON T2.C = T1.C AND T2.D BETWEEN T1.D1 AND T1.D2
GROUP BY T1.C,T1.D1,T1.D2
追问提示between操作符之间没有And在查询表达式中
MySQL?
温馨提示:答案为网友推荐,仅供参考
第1个回答 2020-05-02
介绍sql语句如何使用函数