簡體   English   中英

SQLite:如何選擇全部,並為某些列另外設置一個值

[英]SQLite : How to select all, and additionally set a value for some column

我有以下查詢。

@Query("SELECT * FROM sounds GROUP BY artistId ORDER BY artist")
        List<Sound> getArtists();

我想選擇全部,然后將isDirectory設置為對於此查詢中返回的所有行都返回true。

我嘗試了這個:

@Query("SELECT *, " +
                "artist AS title," +
                "isDirectory AS 'true' " +
                "FROM sounds GROUP BY artistId ORDER BY artist").

我意識到這是針對列別名的,有沒有辦法使用類似於AS的名稱,而不是名稱,而是值。

嘗試使用'true' AS isDirectory而不要'true' AS isDirectory

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM