目前的SQL:
select a.*,(select Count(ID) From uploadFile where objectType =a.TypeID) AS UploadFileCount From activity as a
就是弄不清楚,要如何加判断,当count记录数为零时,UploadFileCoun赋值作字符串''。
select a.*,(select Count(ID) From uploadFile where objectType =a.TypeID) AS UploadFileCount From activity as a
就是弄不清楚,要如何加判断,当count记录数为零时,UploadFileCoun赋值作字符串''。
继续求解!!
case when (select Count(ID) From uploadFile where objectType =a.TypeID)=0 then ''else 'a' end AS UploadFileCount
From activity as a