Re: [PHP-DB] select * from table where column 'CONTAINS' more than one value (how?)

2005-06-22 Thread Dan Fulbright

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
-  
4565
45615
45634

--df

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



Re: [PHP-DB] select * from table where column 'CONTAINS' more than one value (how?)

2005-06-22 Thread Micah Stevens



On Tuesday 21 June 2005 10:35 pm, Dan Fulbright wrote:
  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:

Good point, this would be the 'Proper' way to do it. 

-Micah 

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



[PHP-DB] select * from table where column 'CONTAINS' more than one value (how?)

2005-06-21 Thread Tramelw
Hello all,
 
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.
 
My question is now that I have more than one value, what format can I use  
for a contain command.
 
EXAMPLE:
 
articles needed local political articles:
 
SELECT * FROM table where column contains politics, local.
 
Does anyone know how to format the above command into a proper SQL query  
language?
 
 
Thank you in advance.


Re: [PHP-DB] select * from table where column 'CONTAINS' more than one value (how?)

2005-06-21 Thread Micah Stevens

You can use LIKE and wildcards, which is faster than fulltext searches, which 
will provide you a lot of information you don't need. 

Do this:

SELECT * FROM table where column LIKE %politics% OR column LIKE %local%

to find if the field contains politics or local.. 

-Micah 

On Tuesday 21 June 2005 05:49 pm, [EMAIL PROTECTED] wrote:
 Hello all,

 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.

 My question is now that I have more than one value, what format can I use
 for a contain command.

 EXAMPLE:

 articles needed local political articles:

 SELECT * FROM table where column contains politics, local.

 Does anyone know how to format the above command into a proper SQL query
 language?


 Thank you in advance.

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