Reputation: 5950
In SQLite, how do I select on another table if a table does not exist? I want to do something like the following in one query:
if not exists(tbl_lite){
select * from tbl_heavy
} else {
select * from tbl_lite
}
Upvotes: 0
Views: 52
Reputation: 13425
In your program, you need to first check if table exists using this query and do select from appropriate table
SELECT name FROM sqlite_master WHERE type='table' AND name='tbl_lite'
Upvotes: 1