已解决:我需要查询SQLite android数据库以查找一列的所有不同值。我的表就是那个例子:
Type | Name
-------|------------
Hotel | Paris
Hotel | Something
Hotel | GoodLife
Resto | teaso
Resto | Nice
School | FirstYear
School | Hai
School | cook
我想要一个查询结果:
Type
------
Hotel
Resto
School
所以如果存在相同的类型,它只从Type中选择一种类型, 这是我的疑问:
SELECT DISTINCT _id, Type FROM TABLE_Service
但结果是:
Type
------
Hotel
Hotel
Hotel
Resto
Resto
School
School
School
thnx ^^
解决方案:
SELECT DISTINCT Type as _id, Type FROM TABLE_Service