Search
 
SCRIPT & CODE EXAMPLE
 

SQL

sql - Counting DISTINCT over multiple columns

SQL> select distinct deptno, job from emp
  2  order by deptno, job
  3  /

    DEPTNO JOB
---------- ---------
        10 CLERK
        10 MANAGER
        10 PRESIDENT
        20 ANALYST
        20 CLERK
        20 MANAGER
        30 CLERK
        30 MANAGER
        30 SALESMAN

9 rows selected.


SQL> select count(*) from (
  2  select distinct deptno, job from emp
  3  )
  4  /

  COUNT(*)
----------
         9

SQL>
Comment

select count distinct multiple columns sql server

SELECT COUNT(DISTINCT (CHECKSUM(DocumentId,DocumentSessionId)) + CHECKSUM(REVERSE(DocumentId),REVERSE(DocumentSessionId)) )
FROM DocumentOutPutItems
Comment

PREVIOUS NEXT
Code Example
Sql :: SQL Syntax of INNER JOIN 
Sql :: mysql workbench format date 
Sql :: not keyword in sql 
Sql :: connect by query in oracle 
Sql :: hibernate show sql xml property 
Sql :: mysql date time string format for marshmellow field schema 
Sql :: left join in sql oracle 
Sql :: hidden error sql codeigniter 3 
Sql :: sql foreign key constraint 
Sql :: mssql replace first occurrence 
Sql :: how to do an average on a count sql 
Sql :: SQL Server modify_timestamp trigger 
Sql :: oracle sql all days except weekends 
Sql :: in in sql 
Sql :: extract postgresql 
Sql :: mssql default connection string 
Sql :: oracle create or replace index 
Sql :: sql revert migration 
Sql :: docker use mysql 
Sql :: keep getting an error when I try to connect to mysql workbench 
Sql :: import sql file to mysql db using shell commands 
Sql :: syntax error at or near "AUTO_INCREMENT" 
Sql :: how to convert null to float in mysql 
Sql :: sql date between one week 
Sql :: Kill session in SQL Developer 
Sql :: default username and password for oracle 11g 
Sql :: mysql date comparison with formatting 
Sql :: sql ignore 
Sql :: sql division operator 
Sql :: mysql ddl 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =