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........
Loading
Vijaya KadiyalaPosted Oct 7, 2008, 3:44 PM
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 DickinsonPosted Sep 1, 2008, 3:38 PM
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.