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 |
|
bjtexas
Starting Member
1 Post |
Posted - 2010-01-14 : 09:48:45
|
| I have a table with fields for location, date, desc, value. There are multiple desc, for each date; multiple dates for each location. For example:city1,01/01/10,desc1,1000city1,01/01/10,desc2,5city1, 01/07/10, desc1,1500city1, 1/7/10, desc2, 30I need to be able to select and present the data by desc field, like: desc1 desc21/1 1000 51/7 1500 30 I am a new sql programmer and tried union and pivots without success. Any suggestions would be appreciated. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-01-14 : 09:50:43
|
| [code]select location,date,[desc1],[desc2]from tablepivot (max(value) for desc in ([desc1],[desc2]))p[/code] |
 |
|
|
|
|
|
|
|