Oledb SQL问题 [英] Oledb SQL Problem
本文介绍了Oledb SQL问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用oledb连接时使用以下SQL查询:
SELECT
Sessions.SessionID,
Sessions.SessionType,
Sessions.SessionDate ,
Count (Bookings.Status) AS BookedPlaces
FROM 会话
LEFT JOIN 预订 ON Sessions.SessionID = Bookings.SessionID
GROUP BY
Sessions.SessionID,
Sessions.SessionType,
Sessions.SessionDate
解决方案
嗨!使用GROUP BY时,必须使用HAVING而不是WHERE。因此,您希望在GROUP BY之后的SQL语句末尾添加
HOOKING Bookings.Status ='Active'
。 br />
http://www.w3schools.com/SQL/sql_having.asp
祝你好运! :)
I have the following SQL query that I am using with an oledb connection:
SELECT Sessions.SessionID, Sessions.SessionType, Sessions.SessionDate, Count(Bookings.Status) AS BookedPlaces FROM Sessions LEFT JOIN Bookings ON Sessions.SessionID = Bookings.SessionID GROUP BY Sessions.SessionID, Sessions.SessionType, Sessions.SessionDate
解决方案
Hi! When you use GROUP BY, you have to use HAVING instead of WHERE. So you would want to put
HAVING Bookings.Status = 'Active'
at the end of your SQL statement, after the GROUP BY.
http://www.w3schools.com/SQL/sql_having.aspGood luck! :)
这篇关于Oledb SQL问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文