Results for “DISTINCT ON”
Small, practical examples. Search by task or narrow things down below.
Combine collections as a distinct set
C#: Union retains each value once across both inputs.
C#✓ Tested
Count distinct values within a result
SQL: COUNT DISTINCT counts distinct non-null values.
SQL✓ Tested
Count distinct values within a result
SQL Server: COUNT DISTINCT counts distinct non-null values.
SQL Server✓ Tested
Count distinct values within a result
Postgres: COUNT DISTINCT counts distinct non-null values.
Postgres✓ Tested
Count distinct values within a result
SQLite: COUNT DISTINCT counts distinct non-null values.
SQLite✓ Tested
Find the second-highest distinct value
SQL: Select the maximum below the overall maximum to skip ties at the top.
SQL✓ Tested
Find the second-highest distinct value
SQL Server: Select the maximum below the overall maximum to skip ties at the top.
SQL Server✓ Tested
Find the second-highest distinct value
Postgres: Select the maximum below the overall maximum to skip ties at the top.
Postgres✓ Tested
Find the second-highest distinct value
SQLite: Select the maximum below the overall maximum to skip ties at the top.
SQLite✓ Tested
List distinct values
Remove duplicate category values from a result.
DISTINCT✓ Tested
Wrap a value in a distinct type
Wrap a value in a distinct type in a complete Rust program using the standard library.
Rust✓ Tested
Combine results without duplicates
Merge compatible result sets with UNION.
UNION✓ Tested