Re: sql question

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

 



if i understand you question...

SELECT columns
FROM table
WHERE (condition #1) AND (condition #2);

You can add many conditions. There are many ways to do this. This one is probably the most simple for only two conditions. Depending on your needs you also may need to create a subquery.

SELECT colummns
FROM table
WHERE (condition#1) AND (
   SELECT columns
   FROM table
   WHERE (condition#1a);

The second is more useful in joins or when joining a table to itself.



William Stokes wrote:

Hello,

This is not a php but sql question. My apologies but I don't know any good sql forums and I know that someone here might be able to answer.

OK so the question is. How to make a SELECT query with WHERE definition that requires 2 conditions to be satisfied so that the row gets selected?

MySQL manual says"where_definition consists of the keyword WHERE followed by an expression that indicates the condition or conditions that rows must satisfy to be selected"

I just don't know how to write the query

Thanks a lot
-Will







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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux