我如何今天/昨天选择两个日期?

时间:2013-11-28 09:15:23

标签: sql-server-2008 date

找到今天 的客户

如何在 SQL

中连接此查询
table
Customer- cno,fname,lname ,address  
oder-oder_no,cno,oderdate
oderline-oder_no,product,Qty,cost

2 个答案:

答案 0 :(得分:1)

这是您要求的查询

select * from  customer where cno in (select cno from oder where (orderdate=getdate() or orderdate = getdate()-1))

答案 1 :(得分:0)

从客户c中选择* 在o.cno = c.cno上加入oder o 在ol.oder_no = o.oder_no上加入oderline ol 其中oderdate> = getdate() - 1