MySQL combined query challenge
I have a table to hold all my program settings and I am trying to figure out how to combine two queries as follows.
Here is table named `Config`. Code:
------------------- Config Table --------------------- - Using the 'Settings' table I check access rights for each page based on a predetermined acess level listed in 'Param3'. If the user access level is 'B' I would do: Code:
"SELECT `Param1` FROM `Config` WHERE `Setting` = 'Access' AND `Param3` LIKE '%B%';" Code:
"SELECT * FROM `Config` WHERE `Setting`='Menu' AND `Param1` IN ('Page1','Page4');" Code:
|
You can't because your database table 'config' is multi-purpose, defining access types, data paths, and menu contents.
To do what you want to do, split the config table into multiple tables, one used to define access, one to do datapaths (or just put that in a flatfile), and one to set up menu contents. Then you can do it all in one multi-table query using joins. |
Thanks for your reply. I did have all this in a "config.php" flat file as arrays and I am trying to move away from that into something easier to manage and easier for people to install without havin to edit PHP files.
I plan on using an interview type install technique and fill in the settings from the answers they give through web forms. I was hoping I could store it all in one table but I am begining to feel the pain of this idea. |
I agree with the other posters that you want separate tables. But, if you're stubborn,
Code:
sqlite> SELECT * FROM Config; |
All times are GMT -5. The time now is 01:26 PM. |