I have a website that stores the parameters <select>in several tables and extracts all the relevant ones depending on the individual page. At the moment I finish the query as follows: SELECT foo FROM foo_tbl;SELECT bar FROM bar_tbl;etc. This is not a very bad problem, but I have to iterate over each selection result separately.
I would like to extract all of them into one grid, then do something like
if $row['foo'] != NULL { add to the foo options }
if $row['bar'] != NULL { add to the bar options }
etc
If I use a query such as SELECT DISTINCT f.foo, b.bar FROM foo_tbl AS f, bar_tbl AS b, I include all possible string combinations (first first line foo, first line foo second, second first line foo, second second line foo, etc. etc.).
Is there a way to make such a choice and have only one instance of each element in the column and fill the remaining rows in the column with zeros?
source
share