Re: select * from table where column 'CONTAINS' more than one value (how?)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have no problem creating a table, using a query from my dbase table  "news":
SELECT * FROM table where column = VALUE. However, now that most of our articles have more than one column type (i.e. instead of just technology, the column can now contain "technology, politics, local".

You need to normalize your tables. Make a table called columntypes, then another called articlecolumntypes. If you have an article with ID 456, and it has column types of technology (ID 5), politics (ID 15), and local (ID 34), you tie the articles table to the columntypes table using the articlecolumntypes table:

articleid  columntypeid
---------  ------------
456        5
456        15
456        34

--df

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux