banner ad

how to get max number using sql query | How to SQL | Forum

You must be logged in to post Login Register


Lost Your Password?

Search Forums:


 






Wildcard Usage:
*    matches any number of characters
%    matches exactly one character

how to get max number using sql query

Topic Locked
UserPost

5:59 am
October 3, 2011


anki

Admin

posts 14

The MAX() function returns the largest value of the selected column.

SQL MAX() Syntax

We use the following SQL statement:

 

SELECT MAX(OrderPrice) AS LargestOrderPrice FROM Orders

6:20 am
October 3, 2011


anki

Admin

posts 14

Use

 

We have the following "Orders" table:

O_Id OrderDate OrderPrice Customer
1 2008/11/12 1000 Hansen
2 2008/10/23 1600 Nilsen
3 2008/09/02 700 Hansen
4 2008/09/03 300 Hansen
5 2008/08/30 2000 Jensen
6 2008/10/04 100 Nilsen

Now we want to find the largest value of the "OrderPrice" column.

We use the following SQL statement:

SELECT O_ID,OrderDate,MAX(OrderPrice) AS LargestOrderPrice FROM Orders

 

7:12 am
October 3, 2011


anki

Admin

posts 14

 

 

SELECT * FROM `student` WHERE mark=(select max(mark) from student)
this is query is working well

About the CodeHelper.in forum

Forum Timezone: Africa/Abidjan

Most Users Ever Online: 14

Currently Online:
7 Guests

Currently Browsing this Topic:
1 Guest

Forum Stats:

Groups: 1
Forums: 9
Topics: 14
Posts: 18

Membership:

There are 82 Members

There is 1 Admin

Top Posters:

khasim – 2
vsreddy – 1
codehelper – 1

Recent New Members: gina123, khasim, vsreddy, codehelper, cindy2012car, sree

Administrators: anki (14 Posts)



banner ad