Jump to content

How to type query?

- - - - -

  • Please log in to reply
3 replies to this topic

#1
Tank314

Tank314

    Newbie

  • Members
  • PipPip
  • 10 posts
How do I type query with maximum value in specific column?
I can select max price but not whole row with max price.

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
You will have to specify each field you want to return, and use the group by clause for those fields as well.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
Tank314

Tank314

    Newbie

  • Members
  • PipPip
  • 10 posts
SELECT *
FROM cars
WHERE price=max
?

#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
Ah:
select * from cars where price = (select max(price) from cars)

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users