There is not "Dual" under SQL Server.
Are you still needing a solution on this one?
Main Topics
Browse All TopicsHi i would like to be able to find out for how many months an account is active.
Now an account can change from different status through out its life time
So for example say I have an account who is currently cancelled.
They started as Active in 29-04-06
then they went to another status in 02-04-2007
then they went to Active in 2008-08-01
then cancelled in 2008-09-03
So the total amount of months that this account was active for was 12
I would like to be able to ideally see the account and then the amount of months they were active for
but i would like to spilt this up by year so something like this using the example above:
2006 8 months active
2007 4 months active
2008 1 month active
I have attached some tables and the query i am using so far to return the account and the amount of months they are active
for.
I have split the report into 2 pieces because in my db i need to be able to calculate a scanero if someone has not actually gone to the system active but with no status recorded until they are then cancelled so i calculate
how many months they are active for by using teh date they were entered into the system to teh date they were cancelled.
but the problem i am having is really trying to layout the results so i can split the report into years with how many months that they were active for.
Can anyone help me with thie please.
Regards,
putoch
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: mmoorePosted on 2008-09-11 at 17:45:27ID: 22456322
Dont know if this works in TSQL but it does in oracle. Anyway, it's not a complete solution to your problem but it may give you some ideas.
Select allOpen in new window