| alper | 05-06-2009 |
|---|
| very productive examples. it teaching GROUP BY statement by one example. thank you for your post. |
| David Koh | 15-06-2009 |
|---|
Another way to get the whole row where max_mark is the highest.
Instead of the below from the example:
SELECT * FROM `student` WHERE mark=(select max(mark) from student)
We can do:
SELECT * FROM `student` ORDER BY max_mark DESC LIMIT 1
This might save db processing power instead of having 2 select statements |
| smo | 17-06-2009 |
|---|
| This is explained here in getting highest number by using limit |
| rammohan | 26-06-2009 |
|---|
| how to get the last entry in pages in a table |
| ajay | 30-07-2009 |
|---|
| how to get name of topper of every class |
| super | 10-08-2009 |
|---|
| What if you had two or three top students (say arnold got 85 as well), how would you display the name of all of them with there mark? |
| smo | 11-08-2009 |
|---|
| You can display top 3 by using order by and limit command. Here is the sql to display top three records. |
| arcavalierenero | 12-09-2009 |
|---|
This sample isn't correct:
SELECT id,name,class,MAX(mark) as max_mark FROM `student` |
| smo | 12-09-2009 |
|---|
| Yes, you are right. To display matching records we have to use subquery. The content is modified with the above explanation. |
| Doug M | 15-09-2009 |
|---|
| I got a complex array I need to build from SQL. Using a theory like this, how could I retrieve the top 3 scores per game from a highscores table? Got a mod I am working on where people are asking that. I am hoping there is a simple SQL solution rather than building a complex array. |
| smo | 17-09-2009 |
|---|
| you can use limit and order by to get top 3 records. |
| karthi | 06-01-2010 |
|---|
| how to display first 2 toppers in the class? any idea.. |
| piyush | 15-04-2010 |
|---|
| I wanted to know how to find the max salary between two table pl tell me |
| rakesh7434 | 07-05-2010 |
|---|
| i have a table with some data i need to reproduce with same data and add new cols to it how to do it please tell me |
| Babs | 18-05-2010 |
|---|
how do i pick the data with the highest currency from dis data?
name itemdesc tamt
smith longe 450
smith longe 470 |
| sai | 01-07-2010 |
|---|
| how to return a zero value if selected value of max(columnname) doesnot exist. |
| manmohan | 29-07-2010 |
|---|
How to get result like this
id name class mark
1 John Deo Four 75
2 Max Ruin Three 85
display max marks in each class with its other associated fields |
| dbl | 03-08-2010 |
|---|
@manmohan something along the lines of
select * from table group by class order by mark asc
should do what you want |
| Atef | 03-10-2010 |
|---|
| how do i select the max ID value from table and insert this value in other ID record which in other table |
| anji | 04-10-2010 |
|---|
I need max value ( in emp_city)in the below talbe
emp_name Emp_id Emp_city
abc 12 cc01
bbc 13 cc02
abc 12 cc01
agc 15 cc03
dbc 16 cc01
Result
cc01
How can i get this one?please tell me anyone? |
| DARSHAN BHAWSAR | 08-11-2010 |
|---|
I need an SQL to get the last updated transaction on the basis of date.
eg.
Date Remarks
13/09/10 a
13/10/10 b
SQL should return value as b since it is last updated transaction. |
| satish.s | 02-05-2011 |
|---|
Dear Sir/madam,
We r dong project on vb with oledb conn with msaccess 2003 how to fetch maximum value of msaccess field to vb 6.0 please send us select statement of this query please do needfull
Regards
Satish.S |
| zorrs | 20-05-2011 |
|---|
| how to select the row/field base on the latest date |
| sanzoO | 07-10-2011 |
|---|
There is table say tbl_data which have the folling data id, user_name, mark1, mark2, mark3, mark4 ......
what ll be the query for finding the name of 3rd heighest scrorer
Help me out... |