[英]Which SQL clause and function allows you to filter for data about one value? (e.g. purchases made by a single customer or on a single date)
在名為Customer Data的數據表中工作,該表包含“客戶名稱”、“日期”和“購買的產品”列,我試圖隔離單個客戶在 2018 年全年的購買。返回該信息的查詢,什么是適當的子句,function,以及我需要使用的語法?
Select * from [customer data]
Where [customer name] = 'John doe'
AND datepart(year, [date]) = 2018
或者
Select * from [customer data]
Where [customer name] = 'John doe'
AND ([date] Between '2018-01-01' AND '2019-01-01')
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.