我如何在Sqlite中编写此查询?请帮我

时间:2012-11-27 08:36:03

标签: android sqlite

我想在sqlite中写这个查询所以请帮助我.....感谢所有

SELECT d.name_ar, d.name_en,d._id
FROM drug_term dt 
INNER JOIN generic_drug d ON d._id = dt.drug_id
WHERE dt.term_id = 1047
AND d.type =1 
GROUP BY d._id    

1 个答案:

答案 0 :(得分:1)

您必须在GROUP BY中提供所有这些字段“d.name_ar,d.name_en,d._id”

SELECT d.name_ar, d.name_en,d._id
FROM drug_term dt 
INNER JOIN generic_drug d ON d._id = dt.drug_id
WHERE dt.term_id = 1047
AND d.type =1 
GROUP BY d.name_ar, d.name_en,d._id