February 12, 2003 at 1:26 pm
I need to run a count of record that will determine the length of time since receive date. I was told to use the CASE construct to group by category:
0-15 days
16-30
31-60
61-180
181-270
271-360
361+
Then format using a pivot table in Excel to display so that you have on the y-axis the Pend reason and the x-axis the age category.
I am a novice to TSQL and don't know where to start.
For example:
Code Date Received
HRE 02/10/03
HRE 02/10/03
HTR 01/24/03
Query Results
0-15 days count 16-30 days count
HRE 2 0
HTR 0 1
February 12, 2003 at 1:31 pm
Here are some example of pivot table queries:
http://www.geocities.com/sqlserverexamples/#pivot1
Gregory Larsen, DBA
If you looking for SQL Server Examples check out my website at http://www.geocities.com/sqlserverexamples
Gregory A. Larsen, MVP
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply