將子查詢的結果當一個column

  • 51
  • 0

將子查詢的結果當一個column

select  top 1 
(select count(*) from tableName
where CONVERT(varchar , CreateDate, 111) = CONVERT(varchar , '2019/04/30' , 111)	
And ColumnX = 'X') as a,
(select count(*) from tableName 
where CONVERT(varchar , CreateDate, 111) = CONVERT(varchar , '2019/04/30' , 111)	
And ColumnX = 'X' and  ColumnY = 'Y' ) as b
from tableName