How to get unique values from 2 columns in postgresql?

by elisha_langworth , in category: MySQL , 9 months ago

How to get unique values from 2 columns in postgresql?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by aubrey , 9 months ago

@elisha_langworth 

To get unique values from 2 columns in PostgreSQL, you can use the following query:

1
2
SELECT DISTINCT column1, column2
FROM your_table;


Replace your_table, column1, and column2 with the actual table name and column names that you want to get unique values from. This query will return a list of unique combinations of values from column1 and column2 in your table.

Related Threads:

How to count unique values across two columns with certain types in postgresql?
How to get unique values from multiple-column values in mysql?
How to get the average from computed columns in postgresql?
How to get values for time intervals of hours in one day in sparql?
How to store all the values in a row to array in postgresql?
How to get unique value in oracle?