This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Select column name where value = something

Hi,

I have this table 'main'

id    name    courseA    courseB    courseC
1     Anna    yes        no         yes
2     Mary    no         yes        yes
3     John    yes        no         no
4     Robb    yes        yes        yes

So, I want to get column names if the search meets my requirement. Example: Get me the column name of those courses which Anna joined.

So it will get the result the column name for name=Anna AND 'column name'=yes

Expected result:

courseA courseC

Anyone?

mysql

Hello CikAlal!

We believe that this post does not fit the main topic of this site.

not related to bioinformatics. Ask stackoverflow.com . (Your database is badly designed, you need 3 tables: person, course, person2course).

For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.

If you disagree please tell us why in a reply below, we'll be happy to talk about it.

Cheers!

0 answers

No answers yet.

Log in to answer this question.