Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
DotNetDeveloper
Starting Member
2 Posts |
Posted - 2008-06-04 : 01:25:09
|
| hai,I have two tablesslno courseid cname1 1 be2 2 bsc(remember) slno is autogenerated.table 2courseid year1 20081 20062 20072 2006I have to join this two table and bind it to gridview likeslno cname year year1 1 2008 20062 2 2007 2006i tried innerjoin,but im getting o/p like slno cname year 1 be 20082 be 2006like that.I have to repeat that year column according to data in table |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-06-04 : 01:30:32
|
Use the new PIVOT operator available in SQL Server 2005. E 12°55'05.25"N 56°04'39.16" |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-04 : 01:31:35
|
| How do you expect to get 1,2,.. for cname field? the table data shows be,bsc,... |
 |
|
|
DotNetDeveloper
Starting Member
2 Posts |
Posted - 2008-06-04 : 01:41:49
|
| how to write PIVOT Query.Can you guide me? |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-06-04 : 01:44:55
|
Yes.1) Write PIVOT in your query window2) Hightlight the PIVOT word3) Press SHIFT+F14) Read the chapter about PIVOT operator on Books Online E 12°55'05.25"N 56°04'39.16" |
 |
|
|
|
|
|