SQL筆記

  • 49
  • 0
Select a.Years,
(Select Count(*) from table where Type = '代碼' and years = a.years) as '代碼異常',
(Select Count(*) from table where Type = '地址' and years = a.years) as '地址異常',
(Select Count(*) from table where Type = '電話' and years = a.years) as '電話異常'
from (Select Distinct years from table ) as a