Let’s say you have a table which stores articles, and each article can have properties, like:
- publish status: A = published, D = draft, P = pending etc
- comment status: C = comments closed, O = comments open
- type: A = article, P = page, G = gallery
- maybe other stuff
Anyway I was wondering if it’s possible to store all this info into a “flags” field, instead of creating multiple fields for each property.
How can I do this in such a way that I can still query my table based on these properties, like SELECT * FROM table WHERE (publish status is "published"), or order them and stuff like that?
SETis what you need.http://dev.mysql.com/doc/refman/5.0/en/set.html