There is nothing weird about that behavior. You asked for all of the rows 
where the School column has both of two different values at the same time.

>> WHERE School='Columbia' and School='Stamford'

if School is 'Columbia' the first part is true but the second part can't 
be and vice versa. Your where clause will always be FALSE (because of the 
AND) so you will never get any rows returned because no row can possible 
satisfy both conditions at the same time.

Try an OR instead or use the IN() operator.

WHERE School='Columbia' OR School='Stamford'

WHERE School IN ('Columbia', 'Stamford')

See the difference?

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine

Stuart Felenstein <[EMAIL PROTECTED]> wrote on 12/01/2004 04:51:26 PM:

> or maybe it's me :)
> 
> Anyway here is my table
> 
> +------------+--------------+
> | RecordID   |   School     |
> | PID,AI,INT |   Varchar    |
> +------------+--------------+
> |  108       |   Columbia   |
> +------------|--------------+
> |  108       |   Princeton  |
> +------------|--------------+
> |  108       |   Stamford   |
> +------------|--------------+
> |  109       |   USC        |
> +------------|--------------+
> |  109       |   NYU        |
> +------------|--------------+
> |  109       |   Columbia   |
> +------------|--------------+
> 
> If I do this:
> SELECT 
>   School,RecordID
> FROM
>   Profiles_Schools
> WHERE
>   School = Columbia 
> I get back RecordID's 108 and 109
> 
> But if in the where statment I add:
> 
> where School = Columbia and School = Stamford
> Nothing is returned 
> 
> Am I doing something wrong.  btw I have comp indexes
> on both columns.
> 
> Thank you ,
> Stuart
> 
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
> 

Reply via email to