Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

android

sqlite

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

Thanks for helping

like image 850
dirko Avatar asked Nov 15 '25 12:11

dirko


1 Answers

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.

like image 141
Michael Low Avatar answered Nov 17 '25 00:11

Michael Low