This will work:
select distinct X from a as a
where Y in(25)
and
not exists (select X from a as b where a.X = b.X and b.Y in(24))
- Original Message -
From: "Tim Molter"
To:
Sent: Sunday, December 27, 2009 4:04 PM
Subject: Is there a better way than this?
I'm new to MySQL and I'm
Tim Molter
Cc: mysql@lists.mysql.com
Subject: Re: Is there a better way than this?
Unless I am missing something, this should work.
SELECT DISTINCT X FROM `A`
WHERE Y IN (25)
AND Y NOT IN (24)
Chris W
Tim Molter wrote:
> I'm new to MySQL and I'm looking for some guidance. I hav
sum(y=24);
>
> Regards,
> Gavin Towey
>
> -Original Message-
> From: Chris W [mailto:4rfv...@cox.net]
> Sent: Sunday, December 27, 2009 6:02 PM
> To: Tim Molter
> Cc: mysql@lists.mysql.com
> Subject: Re: Is there a better way than this?
>
> Unless I am missing som
Thanks for the replies!
Chris, yeah, that's the first thing I tried. The problem though is
that SQL statement also returns Row #2 (x=1, y=25) since y=25 is
associated with both x=1 and x=2. I want it only to return row #3.
As John said, it may not be possible with a simple SQL statement.
My tabl
Unless I am missing something, this should work.
SELECT DISTINCT X FROM `A`
WHERE Y IN (25)
AND Y NOT IN (24)
Chris W
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
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