topics

全部话题 - 话题: salesdate
(共0页)
m******t
发帖数: 6905
1
来自主题: Database版 - 面试中的一道sql的题目。
Hi all
I created a table and tried the solution above but it failed. who can help
--Creat Table and loading data by using bulk insert
Drop Table Test20140317
Create Table Test20140317
(SalesDate date,
Sales Decimal)
Bulk insert Test20140317
from 'C:\filepath\Book1.txt'
with
(ROWTERMINATOR = '\n',
firstrow = 2)
select * from Test20140317
--Here is the above solution, I used DateName function to display week days.
select
Month(SalesDate),
case when DATENAME(WEEKDAY,(SalesDate)) = 0 then ... 阅读全帖
d***e
发帖数: 793
2
来自主题: Database版 - 面试中的一道sql的题目。
sum(case when DATENAME(WEEKDAY,(SalesDate)) = 0 then sales else 0 end)
(共0页)