Skip to content

Instantly share code, notes, and snippets.

@shyuan
Created December 14, 2017 02:38
Show Gist options
  • Save shyuan/db1eda24e98c8c1e344018f7b237a3ee to your computer and use it in GitHub Desktop.
Save shyuan/db1eda24e98c8c1e344018f7b237a3ee to your computer and use it in GitHub Desktop.
計算某欄位是否為 NULL 的資料筆數
SELECT IF( ISNULL(deleted_at), 'NO', 'YES') AS is_deleted, COUNT(1) FROM xx_table GROUP BY is_deleted;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment