Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Using MAX( ) function in SQL.
Jack,
If you are wanting the maximum cost by color, partno, and description, you are going to need to use a GROUP BY clause. After your FROM clause, type GROUP BY and then all of the fields in your SELECT statement that does not have MAX in front of it. Jonathon is right, you need to think about how you are asking the question in order to know exactly how the syntax should look.
Good luck!
Kevin
"Jack Torrence" <poo_at_127.0.0.1> wrote in message
news:MPG.148b2b70162f279298968d_at_news.ntlworld.com...
> Hi
>
> I am having trouble with a question I have been set for
> uni.
>
> my table is as follows;
>
> part(partno, description, colour, cost);
>
> I need to use the MAX function, to select the row with the
> maximum cost, and the other 3 fields.
>
> SELECT MAX(cost), colour, partno
> FROM part;
>
> Why can`t I do this? what is wrong with the syntax, or am I missing
> something maybe.
>
> I have also tried
>
> SELECT MAX(cost), MAX(colour), MAX(partno)
>
> but that only selects the max of each individual field.
>
> Can anyone help?
Received on Sun Nov 26 2000 - 16:36:12 CST
![]() |
![]() |