Women in Technology

Hear us Roar



Article:
  SQL Subqueries
Subject:   Subquery
Date:   2006-04-01 05:21:25
From:   rooman
i want to count comm col in emp table.there are some NULL values.i want my screen to show me two columns ,one telling me the count on NULL values and the other on NOT NULL values.
Main Topics Newest First

Showing messages 1 through 1 of 1.

  • Subquery
    2006-04-05 21:18:52  paul21_7 [View]

    SELECT
    COUNT(SELECT 1 FROM emp WHERE comm IS NULL) AS null_count,
    COUNT(SELECT 1 FROM emp WHERE comm IS NOT NULL) AS not_null_count
    FROM dual

    enjoy!