January 25, 2012 at 4:54 am
Help with query.
I have a table with columns
PAN
ProgramID
TransactDate
I need to write a stored proc that would do the following tasks.
1. The input to the stored proc is start date and end date.
2. From the start date month wise I need to find out the list of pans repeating each month and the deleted or new pans added next month and so on.
For eg.
Jan 2011 to April 2011
PAN ProgramID TransacDate
1 A 1/1/2011
2 B 2/1/2011
1 A 2/2/2011
3 C 3/2/2011
1 A 4/3/2011
3 C 4/3/2011
4 D 5/3/2011
So PAN 1 is repeating everymonth
PAN 2 is deleted in feb and PAN 3 is added in feb. and 4 is added in march
SO The output has to be
Repeated Pans, Pans deleted and Pans added. I would require count of these month wise.
Kindly throw some inputs..
Thanks,
Sandesh
January 25, 2012 at 5:00 am
Please post table definitions, sample data and desired output. Read this to see the best way to post this to get quick responses.
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply