|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Display rows as columnsi have a table like Id , ColumnName group 1 C1 1 2 C2 1 3 C3 2 these columns are mapped to another table like Id C1 C2 C3..... so the columns tht must be selected from the transaction table differs according to the group in the mapping table. so can i write a query to get the data from transaction table for a group in mapping table. I DONT WANT TO USE DYNAMICALLY CREATED QUERY.. plz send the solution as the client is waiting Renjith Hi Renjith
Probably you can use CASE statement for this. This is similar to DECODE statement available in Oracle. Please post the expected result so that we can give u a solution -- Show quotebest Regards, Chandra http://chanduas.blogspot.com/ http://www.SQLResource.com/ --------------------------------------- "Renjith" wrote: > Hi > > i have a table like > > Id , ColumnName group > 1 C1 1 > 2 C2 1 > 3 C3 2 > > these columns are mapped to another table like > > Id C1 C2 C3..... > > so the columns tht must be selected from the transaction table differs > according to the group in the mapping table. > > so can i write a query to get the data from transaction table for a group > in mapping table. > > I DONT WANT TO USE DYNAMICALLY CREATED QUERY.. > > plz send the solution as the client is waiting > > Renjith > > Id , ColumnName group Sounds like a cross-tab / pivot.> 1 C1 1 > 2 C2 1 > 3 C3 2 > > these columns are mapped to another table like > > Id C1 C2 C3..... http://www.aspfaq.com/2462 > plz send the solution as the client is waiting So why is the client paying YOU? I wonder what the client would think if they saw your post and recognized you as their consultant? Hi
i need the result as when i select group = 1 Id C1 C2 the value of c1 , c2 will be transaction table when i select group = 2 Id C3 the value of C3 will be transaction table Renjith Show quote "Renjith" wrote: > Hi > > i have a table like > > Id , ColumnName group > 1 C1 1 > 2 C2 1 > 3 C3 2 > > these columns are mapped to another table like > > Id C1 C2 C3..... > > so the columns tht must be selected from the transaction table differs > according to the group in the mapping table. > > so can i write a query to get the data from transaction table for a group > in mapping table. > > I DONT WANT TO USE DYNAMICALLY CREATED QUERY.. > > plz send the solution as the client is waiting > > Renjith > > i need the result as
http://www.aspfaq.com/5006
> when i select group = 1 > > Id C1 C2 > > the value of c1 , c2 will be transaction table > > when i select group = 2 > > Id C3 > > the value of C3 will be transaction table |
|||||||||||||||||||||||