| Author |
Topic |
|
divyaram
Posting Yak Master
180 Posts |
Posted - 2010-01-12 : 05:36:03
|
hi all, select Title,[1] as user1,[19] as user2,[25]as user3 from (select First_Name, Last_Name,Email_ID,Title from FIS_User) upivot(count(Position_ID)for Industry_ID in ([1],[19],[25]))as pvorder by pv.First_Namei have done like this , but its throwing error Msg 207, Level 16, State 1, Line 4Invalid column name 'Position_ID'.Msg 207, Level 16, State 1, Line 4Invalid column name 'Industry_ID'.but all this columns are there in the table.... then why its throwing error like thisRegards,Divya |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-01-12 : 05:41:30
|
quote: Originally posted by divyaram hi all, select Title,[1] as user1,[19] as user2,[25]as user3 from (select First_Name, Last_Name,Email_ID,Title,Position_ID,Industry_ID from FIS_User) upivot(count(Position_ID)for Industry_ID in ([1],[19],[25]))as pvorder by pv.First_Namei have done like this , but its throwing error Msg 207, Level 16, State 1, Line 4Invalid column name 'Position_ID'.Msg 207, Level 16, State 1, Line 4Invalid column name 'Industry_ID'.but all this columns are there in the table.... then why its throwing error like thisRegards,Divya
you've not included the columns in derived table |
 |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2010-01-12 : 05:56:51
|
| simply u can use like thisselect Title,[1] as user1,[19] as user2,[25]as user3 fromFIS_Userpivot(count(Position_ID)for Industry_ID in ([1],[19],[25]))as pvorder by pv.First_Name |
 |
|
|
divyaram
Posting Yak Master
180 Posts |
Posted - 2010-01-12 : 06:45:48
|
thank u all its wrking fine.... now i understood my mistake in query thank u alllRegards,Divya |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-01-12 : 06:47:33
|
quote: Originally posted by divyaram
thank u all its wrking fine.... now i understood my mistake in query thank u alllRegards,Divya
welcome |
 |
|
|
|
|
|