You are here: Re: How can I write a min query? « PHP SQL « IT news, forums, messages
Re: How can I write a min query?

Posted by ZeldorBlat on 09/27/23 11:40

laredotornado@zipmail.com wrote:
> Hello,
>
> I have a table with vacation offier_id's and prices
>
> OFFER_ID PRICE
> --------------- --------
> 1 50.00
> 2 75.00
> 1 85.00
> 1 45.00
> 2 200.00
>
> I want to write a query to return the offer_id with its lowest price.
> The result of scanning the above data would be
>
> OFFER_ID PRICE
> --------------- ---------
> 1 45.00
> 2 75.00
>
> Using MySQL 4, is there any way to write a single query to do this?
> I'm using PHP 4 also.
>
> Thanks, - Dave

select OFFER_ID, min(PRICE)
from VACATIONS
group by OFFER_ID
from

 

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

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