The DB I'm working on has roughly 30 tables that might contain different pieces of data I'd like to locate. Not an ideal situation but hey ho.
Given two strings...
string1
- value that appears in table name.string2
- value to be searched for text-like columns.
...I'd like to search all tables with name matching string1
for columns that have a datatype in...
- text
- char
- varchar
... for data rows like "%string2%"
.
What I'd ideally see returned is a resultset with a row for each string1
, string2
hit, in a format like:
- table_name_string1_appears_in
- colum_name_string2_appears_in
- value_from_id_col_of_table_with_name_like_string1
- data_from_cell_matching_string2
Can a pure mysql solution exist for this that is re-usable?