0
我想編寫一個sqlite查詢,其中將顯示一條記錄,例如我有一個聯繫表和賬戶表我想從表中獲取一個賬戶名和聯繫人姓名要GROUP_CONCAT聯繫人名稱,它不應該被重複,所以我返回查詢:顯示記錄以asc順序在sqlite中使用group_concat android
select a.account_name, group_concat(DISTINCT c.contact_name) from account_table a join contact_table c on a.account_id = c.account_id;
此查詢執行完全知道我想要做的是在遞增爲了得到GROUP_CONCAT不同的名字,所以我寫的查詢:
select a.account_name, group_concat(DISTINCT c.contact_name order by c.contact_name) from account_table a join contact_table c on a.account_id = c.account_id;
它給我e可以通過
10-25 10:29:25.601: E/SQLiteLog(2214): (1) near "order": syntax error
可以任何一個告訴我如何解決這個錯誤。
它不是在SQLite的工作 –