4

How to Distinct one column from all the column that i choose in Sqlite?

Thanks for helping

2 Answers 2

21

If you're only selecting one column, it's easy:

SELECT DISTINCT col1 FROM table 

If you mean you're selecting multiple columns, but only one want one of them to be distinct you can do:

SELECT col1 , col2 , col3 FROM table GROUP BY col1 

Obviously you need to be careful about whether this means you're going to miss some data from col2 and col3 that you need. Sometimes it's better to select more and filter client-side instead.

Sign up to request clarification or add additional context in comments.

Comments

0

Use the DISTINCT keyword in your query :

SELECT DISTINCT column FROM table 

Hope this helps,

Phil Lello

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.