If suppose I have one table Customers,fields Cus_Id as primary key,Cus_Name and Second table i.e., Orders table,Order_Id as primary key,Cus_Id reference to the Customers table,and Order_date.
Now my Question is that,I want to display the data like this:
Cus_Name 1996 1997 1998
Cus_1 8 5 1
Cus_2 5 3 2
Cus_3 4 0 4
Cus_4 11 25 0
And Year should be dynamically growable.
So I can judgement that,why Cus_4 has not been ordered in year 1998?
Suggestion is required........
Database Query
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Vijaya KadiyalaRank #1,085 · 1.8K reputationPosted Oct 7, 2008, 11:44 AM EDT
Hi
You can try using PIVOT but this is also limited to the No.Years..Every time you have a new year you need to change this query.
Thanks -- Vj
http://dotnetvj.blogspot.com
http://oravj.blogspot.com
Mark Dickinson4 reputationPosted Sep 1, 2008, 11:38 AM EDT
Sorry i don't fully understand. are you having trouble displaying data in Console Application?
Or is the question more how do i do the programing for the variables.