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 |
|
skillile
Posting Yak Master
208 Posts |
Posted - 2001-11-05 : 09:06:44
|
| --I have this and it is not flexibleSELECT convert(varchar(20),a.sdate, 108),UID, MIN( CASE b.UID WHEN 1 THEN b.sdesc END ), MIN( CASE b.UID WHEN 2 THEN b.sdesc END ), MIN( CASE b.UID WHEN 3 THEN b.sdesc END )FROM #dayview aLEFT JOIN #events b ON a.sdate=b.sdateGROUP BY a.sdate, UIDORDER BY a.sdate--I want to do thisDECLARE @count intDECLARE @x intSET @x= 1SET @count=3DECLARE @sql nvarchar(1000)WHILE @x <= @countBEGIN @sql = @sql + 'MIN( CASE b.UID WHEN ' + @x + 'THEN b.sdesc END )', @x=@x+1ENDSELECT convert(varchar(20),a.sdate, 108), @sql,FROM #dayview aLEFT JOIN #events b ON a.sdate=b.sdateGROUP BY a.sdate, UIDORDER BY a.sdateNot sure how to get there.Thanksslow down to move faster... |
|
|
|
|
|