Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2012
    Posts
    91

    Unanswered: The same data in column

    Hi.
    Is there a query to check if all data in one column are the same? Thanks.

  2. #2
    Join Date
    Jan 2012
    Posts
    84
    Just count distinct values in a column, like this.
    Code:
    SELECT CASE WHEN count( DISTINCT column ) < 2 
                THEN 'SAME' 
                ELSE 'NOT SAME' 
           END result 
    FROM table;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •