Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
select * from tbl_Logsid LogName LogDate1 out20061106_1.rar 2008-03-092 in20061201_1.rar 2008-04-073 in20061201_2.rar 2008-04-084 in20061201_3.rar 2008-04-085 in20061202_1.rar 2008-04-096 out20061202_1.rar 2008-04-101. Prepare a query that returns a list of unique dates and the total number of logs for each date.2. Prepare a query that returns the total logs that occurred on the 9th day of any month.Please help
khtan
In (Som, Ni, Yak)
17689 Posts
Posted - 2009-06-23 : 21:13:22
what have you tried ?KH[spoiler]Time is always against us[/spoiler]
eonmantra
Starting Member
11 Posts
Posted - 2009-06-23 : 21:18:06
Well if I am reading the questions correctly...1.
SELECT LogDate, COUNT(*) AS TotalNumLogsFROM tbl_LogsGROUP BY LogDate;output:LogDate TotalNumLogs---------- ------------2008-03-09 12008-04-07 12008-04-08 22008-04-09 12008-04-10 1(5 row(s) affected)
2.
SELECT COUNT(*) AS TotalLogsFROM tbl_LogsWHERE DAY(LogDate) = 9;output:TotalLogs-----------2(1 row(s) affected)