我在使用聚合函数和BETWEEN子句获取数据时遇到了麻烦。
$statusQ = "SELECT COUNT(total_submit_sub) AS noofsub
FROM total_noof_sub
WHERE sub_name = 'PHP'
AND sem = '8'
AND dept = 'CE'
AND laborlec = 'Lab'
AND faculty_name = 'user'
AND adate BETWEEN '2019/01/01' AND '2019/03/30'";
答案 0 :(得分:0)
$statusQ = "SELECT COUNT(total_submit_sub) AS noofsub
FROM total_noof_sub
WHERE sub_name = 'PHP'
AND sem = '8'
AND dept = 'CE'
AND laborlec = 'Lab'
AND faculty_name = 'user'
AND convert(DATETIME,adate) BETWEEN Convert(DATETIME,CASE WHEN isnull(2019/01/01,'')='' THEN adate ELSE isnull(2019/01/01,'') END)
AND Convert(DATETIME, CASE WHEN isnull(2019/03/30,'')='' THEN adate ELSE isnull(2019/03/30,'') END)
请尝试使用此代码, NULL 也是句柄。...
谢谢!!!!!
答案 1 :(得分:0)
$statusQ = "SELECT tsid FROM total_noof_sub WHERE sub_name = 'PHP'
AND sem = '8'
AND dept = 'CE'
AND laborlec = 'Lab'
AND faculty_name = 'user'
AND adate BETWEEN '$from_date' AND '$to_date' ";
$countnoofsub = mysqli_query($connect, $statusQ);
$num_sub = mysqli_num_rows($countnoofsub);
不会。行,我们想要什么。