I am trying to select the column names from a specific table, where the table name is like '98673'
So I am using this:
SELECT
column_name
FROM
information_schema.columns
WHERE
table_name='lime_survey_98673'
AND column_name LIKE '98673'
However this will not result in any data. Though I do have column names with '98673Blah' in there.
I know I must be doing something wrong, but what??
For the LIKE you have to add a wildcard %, so:
SELECT
column_name
FROM
information_schema.columns
WHERE
table_name='lime_survey_98673'
AND column_name LIKE '98673%'
USE %
SELECT column_name
FROM information_schema.columns
WHERE table_name='lime_survey_98673'
AND column_name LIKE '%98673%'
%
indicates a wildcard and returns any column_name
that contains 98673
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With