Suppose you have a table with many property fields, such as:
id datetime q a c d . . . (etc)
where q,a,c,d etc denote an indefinite number of int fields whose names are generated (also created at runtime)
How do you select with the constraint that some specific fields are a specific number and all others are 0?
(for example) a=1, c=5, and all others are 0?
Update:
I guess what i'm asking for is if there is some "holistic" function or something where i can just go "WHERE ALL OTHERS = 0" (or something like that).
The issue with normalizing is that even after the join, I still have to check for both the specific non-zero values as well as whether all other fields (or the normalized field) is 0.
Concrete application:
table of chemical compounds
id name C Fe Cl H . . . (etc - fields are added when new compound insert contains elements not listed)
example row:
name = Hydrochloric acid C = 0 Fe = 0 Cl = 1 H = 1 . . . (everything else = 0)
The problem with having a simple SELECT * FROM table WHERE H=1 AND Cl = 1
is that it also includes the other cases such as C Cl H (which even though it has C=1, it's selected because Cl and H are both 1 as well)
This is why I'm trying to figure out how to select it where all other fields are 0!