1.查找在9月份完成的所有销售。2. saldate格式是年/月/日,命令中缺少最后一行吗?
select s.orderno "order number",sa.saledate "sale date", st.lastname "last
name"
from sales s, sales sa, staff st
where s.orderno = sa.orderno and
sa.staffno = st.staffno and
sa.saledate = ????????;发布于 2017-05-08 08:44:49
您可以使用mysql函数 month 查找特定日期的月份,并使用STR_TO_DATE将字符串解析为日期:
select s.orderno ,sa.saledate , st.lastname
from sales s, sales sa, staff st
where s.orderno = sa.orderno and
sa.staffno = st.staffno and
MONTH(sa.saledate) = 9月份:http://www.w3resource.com/mysql/date-and-time-functions/mysql-month-function.php
STR_TO_DATE:http://www.w3resource.com/mysql/date-and-time-functions/mysql-str_to_date-function.php
https://stackoverflow.com/questions/43837939
复制相似问题