我试图取消今天所做的所有预订,但是我在最后一行遇到了语法错误。
SELECT
booking.BookingID, booking.CustID, booking.CostID, booking.DateOut,
customer.Fname, customer.Sname, costume.Description, costume.Size
FROM
booking
INNER JOIN
customer ON booking.CustID = customer.CustID
INNER JOIN
costume ON booking.CostID = costume.CostID
WHERE
booking.DateOut = Date();
任何帮助表示赞赏!
错误消息: #1064 - 您的SQL语法有错误;检查与您的MySQL服务器版本对应的手册,以便在#")附近使用正确的语法 限制0,25和#39;在第7行
答案 0 :(得分:3)
SELECT
booking.BookingID, booking.CustID, booking.CostID, booking.DateOut,
customer.Fname, customer.Sname, costume.Description, costume.Size
FROM
booking
INNER JOIN
customer ON booking.CustID = customer.CustID
INNER JOIN
costume ON booking.CostID = costume.CostID
WHERE
booking.DateOut = CURDATE();
答案 1 :(得分:1)
SELECT booking.BookingID,
booking.CustID,
booking.CostID,
booking.DateOut,
customer.Fname,
customer.Sname,
costume.Description,
costume.Size
FROM booking
INNER JOIN customer
ON (booking.CustID = customer.CustID)
INNER JOIN costume
ON (booking.CostID = costume.CostID)
WHERE booking.DateOut = new_DATE(sysdate);
答案 2 :(得分:1)
Date()函数用于提取日期或日期时间表达式的日期部分。 即日期(' 12/02/2014 4.33 p.m')将为您提供#12; 02/2014'。 所以你必须为这个函数提供一个参数。
根据您的要求,您应该使用 CURDATE()功能。