On 12/27/2009 06:04 PM, Tim Molter wrote:
> I'm new to MySQL and I'm looking for some guidance. I have a table A,
> with two columns X and Y with the following data:
>
> | X | Y |
> 1 24
> 1 25
> 2 25
> 2 26
> 3 27
>
> I want my SQL query to return "2" following this verbose logic: SELECT
> DISTINCT X FROM A WHERE Y equals 25 and Y also does NOT equal 24.
Since y=25 is associated with both x=1 and x=2, there's no way a simple
select can result in 2.
Perhaps your assignment calls for the count() of the results?
select count(*) from A where y = 25
Good luck,
John