August 31, 2010 at 2:37 am
I have the following query:
SELECT Investment, DateKey, Amount FROM InvTransaction WHERE Investment In (@Investment) AND DateKey BETWEEN @StarteDate AND @EndDate
Sample Data
SEE ATTACHMENT TABLE1.JPG
I want to use this query so that that is displays in a CrossTab layout. Problem is the data will be generic, meaning user can select any range of dates or any combination. This means using a PIVOT statement might not do the job.
Sample Data
SEE ATTACHMENT TABLE2.JPG
Is there an easy way to achieve this?
[font="Courier New"]-----------------------------------------------------------------------------------------------------------------------
😀 Arguing with Programmers are like wrestling a pig in mud, soon you realize the pig is enjoying it. 😀
-----------------------------------------------------------------------------------------------------------------------[/font]
August 31, 2010 at 6:49 am
Please have a look at the DynamicCrossTab article referenced in my signature. I guess this approach will do the job.
If you need further assistance please provide table def, sample data and expected result as described in the first link in my signature.
Edit: some of us (including me) don't really bother to look at jepg's. We rather prefer to get ready to use sample data so we can provide a tested solution. Or would you prefer the answer as a jpeg showing pseudo-code? I guess not... 😉
August 31, 2010 at 7:32 am
Thanks that link might do the trick.
And by the way - taking "sample data" from the database I'm working on, will consume to much of my time as it is an extremely complex financial database. Plus I have no specific data I wont to work with. Just the concept I want to explore. 😛
[font="Courier New"]-----------------------------------------------------------------------------------------------------------------------
😀 Arguing with Programmers are like wrestling a pig in mud, soon you realize the pig is enjoying it. 😀
-----------------------------------------------------------------------------------------------------------------------[/font]
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply