You are here: Re: Retrieve ONLY first/max « MsSQL Server « IT news, forums, messages
Re: Retrieve ONLY first/max

Posted by Ed Murphy on 09/18/07 07:30

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.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация