Solved

Record count by day / date

Posted on 2011-02-14
4
294 Views
Last Modified: 2012-06-27
Hi All,

What would be the sql for a record count by date for this table?

select txn_id, labelid, value, months, date, proc_dd, proc_mm,proc_yyyy from history

Thanks
0
Comment
Question by:lp84
4 Comments
 
LVL 8

Expert Comment

by:kingjely
Comment Utility
select count(txn_id) as count, txn_id, labelid, value, months, date, proc_dd, proc_mm,proc_yyyy from history
group by day(date)

Something like the above

0
 
LVL 50

Expert Comment

by:Lowfatspread
Comment Utility
like this probably

if you want more we need the data types of the columns and some sample
data would also be nice....


select proc_yyyy,proc_mm,proc_dd,count(*) as records
from history
group by proc_yyyy,proc_mm,proc_dd
order by 1 desc,2 desc,3 desc

Open in new window

0
 

Author Comment

by:lp84
Comment Utility
they are all text and value is numeric and date is date
0
 
LVL 23

Accepted Solution

by:
Rajkumar Gs earned 500 total points
Comment Utility
select date, count(*) as recordcount  from history
group by date
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now