0

SQLITE DATABASE IS IN BELOW FORMAT:

Below TABLES are there DataModel File

_1011_105
_1011_106
_1011_107

and so on

and the _1011_106 (format of tables _1011) have below Columns (like ID,MODEL etc).

I did Below query search for searching all the tables in SqLiteDatabase

select name FROM sqlite_master where tbl_name like '%$_1011%' ESCAPE '$'

But I need to run one more query from the result of above query From above query I got all the names like

_1011_2
_1011_106
_1011_107

Hence I need to run query on these list like

Select * FROM (on each element of list I got from above query) WHERE MODEL='4001'

How this can be done in nested way?

Something like

select * from (select name FROM sqlite_master where tbl_name like '%$_1011%' ESCAPE '$');

1 Answer 1

1

SQLite has no mechanism to create dynamic SQL.

You have to read the list of table names first, and then construct a compound query like this in your program:

SELECT ...
FROM (SELECT * FROM _1011_105
      UNION ALL
      SELECT * FROM _1011_106
      ...)
WHERE Model = '4001';
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.