Reputation: 259
I need to check whether a given table, more specifically two are in the database, for this I have written such SQL command
SELECT COUNT(*) as number
FROM information_schema.tables
WHERE table_schema = "__pricelist_countries"
AND table_schema = "__pricelist_ranges"
Unfortunately - although a table with this name is present in my database, SQL always returns 0 rows, which in turn causes the same condition to occur in PHP. Hence the question - how do I make a mistake, or how can I otherwise construct a command to be correct and return the result, or is this table actually or not?
Upvotes: 0
Views: 44
Reputation: 13393
You should use OR
SELECT COUNT(*) as number
FROM information_schema.tables
WHERE table_schema = '__pricelist_countries'
OR table_schema = '__pricelist_ranges'
Upvotes: 2