SQL
1 sql = "SELECT c._id, c.name, c.type1, c.type2, c.publisher, c.author, c.english, c.official1, c.official2, c.official3, count(c._id), count(l.generation_id) " + 2 "FROM collection AS c " + 3 "INNER JOIN collection_generation AS cm ON c._id=cm.generation_id" + 4 "LEFT JOIN( SELECT DISTINCT log.generation_id FROM log) AS l " + 5 "ON cm.generation_id=l.generation_id" + 6 "GROUP BY c._id;";
というSQLに、「type1」に「国」という文字が入っているカラムに限定して抽出した結果がほしいので
SQL
1 sql = "SELECT c._id, c.name, c.type1, c.type2, c.publisher, c.author, c.english, c.official1, c.official2, c.official3, count(c._id), count(l.generation_id) " + 2 "FROM collection AS c " + 3 "WHERE type1 = " + getQuery() + " " + 4 "INNER JOIN collection_generation AS cm ON c._id=cm.generation_id" + 5 "LEFT JOIN( SELECT DISTINCT log.generation_id FROM log) AS l " + 6 "ON cm.generation_id=l.generation_id" + 7 "GROUP BY c._id;";
"WHERE type1 = " + getQuery() + " " +
という一文を追加したところ、SQLのエラーが発生します。
SQL構文が間違えているんでしょうか?
ちなみに、Androidアプリの開発中で、SQLiteを使用し、「rawQuery(sql,null)」というメソットの引数として与える構文です。
間違えてる点をご指摘頂きたいです。
よろしくお願いします。
回答4件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/10/17 02:10 編集
2016/10/17 01:56
2016/10/17 02:15