Afficher un message
Vieux 18/09/2007, 08h30   #4
Ed Murphy
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Retrieve ONLY first/max

David Portas wrote:

> Alternatively you can do the following using standard ANSI SQL, which should
> work on many different platforms:
>
> SELECT type
> FROM ord, product
> WHERE ord.id = product.id
> GROUP BY type
> HAVING SUM(units) >= ALL
> (SELECT DISTINCT SUM(units)
> FROM ord, product
> WHERE ord.id = product.id
> GROUP BY type);
>
> (untested)


This could return multiple values if there's a tie for most
common type.
  Réponse avec citation
 
Page generated in 0,06069 seconds with 9 queries