消息 156,级别 15,状态 1,第 1 行 关键字 'case' 附近有语法错误。

--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)

翻阅古今
浏览 1083回答 1
1回答

qq_遁去的一_1

max(case 前面没空格...
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

SQL Server