Answer the question
In order to leave comments, you need to log in
How to find data for all tables from a specific column?
There is a file SQLITE3 base.db
Contains many tables.
Each table has a referer column name, you need to search all data tables from the referer column, for example, a word containing yandex from the referer column
Answer the question
In order to leave comments, you need to log in
We generate a query for all tables:
SELECT
GROUP_CONCAT('select "' || name || '" table_name, * from `' || name || '` where referer = "yandex"', ' union ') q
FROM
sqlite_master
WHERE
type ='table' AND
name NOT LIKE 'sqlite_%';
select "t1" table_name, * from t1 where referer = "yandex" union select "t2" table_name, * from t2 where referer = "yandex"
+============+====+=========+
| table_name | id | referer |
+============+====+=========+
| t1 | 2 | yandex |
+------------+----+---------+
| t2 | 20 | yandex |
+------------+----+---------+
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question