开发者

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

开发者 https://www.devze.com 2023-02-23 08:27 出处:网络
How to Distinct one column from all the column that i choose in Sqlite? Thanks for 开发者_Python百科helpingIf you\'re only selecting one column, it\'s easy:

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

Thanks for 开发者_Python百科helping


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.


Use the DISTINCT keyword in your query :

SELECT DISTINCT column FROM table

Hope this helps,

Phil Lello

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号