|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Max function
i have this statement which should display the printer model with the highest price but it doesn't work.. it also displays other models! mybe im missing sumtng!
select model, max(price) from printer group by model |
|
#2
|
|||
|
|||
|
Try this: Code:
select model, price from printer where price = (select max(price) from printer) |
|
#3
|
||||
|
||||
|
Quote:
That statement isn't asking for the highest priced model in the database, it is asking for each highest priced model in the database. If you want to limit to the very first row, then you can try the following: select model, max(price) from printer group by model fetch first 1 row only |
|
#4
|
|||
|
|||
|
For this requirement: Quote:
This solution: Code:
Select Model, Price From Printer Where Price = (Select Max(Price) From Printer) |
![]() |
| Viewing: Dev Shed Forums > Databases > DB2 Development > Max function |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|