Getting specific column name of a table
I am working on a project and I got stuck with a query in which I want to get the specific column name of a table whose value is “no.”
I have a table with name subscription and it has four fields; id(
varchar) and my email, sms and phone field have values either ‘yes’ or ‘no’.
Now I want to retrieve the name of only those columns which has a value ‘no’.
I want to execute this query in mysql.
I have tried the following query which is returning me the complete row wherever there is even one occurence of ‘no’:
SELECT * FROM test.subscription WHERE 'no' IN (email,sms,phone);
Like i have these two rows now i want to select the column name where value=’no’ and id=1