--try: declare @sql1 varchar(8000) set @sql1='' select @sql1=@sql1+'max(case when PicTitle='''+PicTitle+''' then PicUrl else 0 end) as ['+PicTitle+']' from Attachment group by PicTitle set @sql1='select'+@sql1+' from Attachment group by PicTitle' exec(@sql1)
消息 156,級(jí)別 15,狀態(tài) 1,第 1 行 關(guān)鍵字 'case' 附近有語(yǔ)法錯(cuò)誤。
翻閱古今
2018-12-07 05:39:46