How about:
SELECT DISTINCT `key`, COUNT(`key`) AS c
FROM `table` WHERE `value` in (8,9,10)
HAVING c=3;
Clever! Thanks :-)
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Morten wrote:
Hi,
Given the table keyval(key int(11), val int(11)), I would like to be
able to retrieve the keys for which a row exist for given X values.
Example:
key value
18
19
110
28
38
310
48
49
410
411
Given values 8, 9, 10 the query should t
Morten wrote:
Hi,
Given the table keyval(key int(11), val int(11)), I would like to be
able to retrieve the keys for which a row exist for given X values.
Example:
key value
18
19
110
28
38
310
48
49
410
411
Given values 8, 9, 10 the query should t
Peter Brawley wrote:
>Can this be expressed somewhat more elegantly than multiple EXISTS
subqueries?
>SELECT DISTINCT key FROM keyval outer
>WHERE EXISTS (SELECT * FROM keyval inner
>WHERE outer.key = inner.key
>AND inner.val = 8)
>AND EXISTS (SELECT * FROM keyval inner
>WHE
>Can this be expressed somewhat more elegantly than multiple EXISTS
subqueries?
>SELECT DISTINCT key FROM keyval outer
>WHERE EXISTS (SELECT * FROM keyval inner
>WHERE outer.key = inner.key
>AND inner.val = 8)
>AND EXISTS (SELECT * FROM keyval inner
>WHERE outer.key = inner.key
>
This is a bit vague.
How about showing what you have done, and how it is not what you wan't.
Colleen Dick wrote:
I am building a SELECT using a left join and I almost have what I want.
One of the fields that gets sucked in from the left join is either
null or has a value in it.
if it is null I
[EMAIL PROTECTED] wrote:
>
> Here is a FABRICATED table I have TYPED OUT to demonstrate the information
> that I'm looking for.
> I'm looking for a single query that can produce:
>
> +--+--++---+
> | clientid | revision | name