I'm working with a table in MySQL that contains the following columns:
id, january, february, march, april, etc
The data in the table looks like this:
aa, 0, 0, 1, 0
ab, 1, 0, 1, 0
ac, 1, 1, 0, 0
ad, 1, 1, 1, 0
To query it, I could easily do this:
select * from table where january = 1 and february = 1
The result would be:
ac, 1, 1, 0, 0
ad, 1, 1, 1, 0
I want to know if there's a way to do it like this:
select * from table where table.columns = 1
I want to use table columns in expression without actually specifying the names manually (typing them out).
Bonus (+1) question:
Could it be done using Match/Against like this:
select * from table
where
(
match (somehow,get,the,table,columns,I,need,here)
against (1 in boolean mode)
)
Thanks for your time! :)