我创建了两个这样的表
**我点击自由战士只有圣雄甘地然后我点击运动人只显示Sania Mirza **
category:ID | NAME
people:ID|NAME|CATEGORY_ID
我的第一个表数据
"1" "Freedom Fighters"
"2" "Sports Person"
"3" "Scientist"
"4" "Politicians"
"5" "Celebrities"
我的第二个表数据
NAME category_id
"Mahatma Gandhi" "1"
"Sania Mirza" "2"
"C. V. Raman" "3"
"Swami Vivekananda" "4"
**我的查询是**
Cursor cursor = db.rawQuery("select * from people where category_id = (select id from category)", null);
但只显示第二个表的第一行
答案 0 :(得分:1)
select * from people where category_id in (select id from category)
在此查询中,您需要......