2

I use an SQLite database on my iPhone application and i need to perform a task that require a nested query. However, my query seems not working, i have googled it and i found that SQLite doesn't support Subquerys. Is there any solution?

EDIT: This is the query that doesn't work for me:

select count(*) from quiz where theme=(select id from theme where nom="Houses") and etat=0;
Luca
  • 20,399
  • 18
  • 49
  • 70

2 Answers2

5

If the subquery (select id from theme where nom="Houses") returns multiple rows,
the theme = wont work. You must use theme IN instead.

select count(*) from quiz where theme IN (select id from theme where nom="Houses") and etat=0;
Nick Dandoulakis
  • 42,588
  • 16
  • 104
  • 136
2

you can use joins instead of nested query, that will work.

for reference please check this...

Nested statements in sqlite

Community
  • 1
  • 1
shofee
  • 2,079
  • 13
  • 30