SQL Recipes
A FREE cookbook for SQL queries and examples
User Name
Remember Me?
Password
Register
FAQ
Search
Today's Posts
Mark Forums Read
SQL - Questions and Answers
Have a SQL question? Post it here. First do a search to see if someone hasn't already answered it.
SQL Recipes a FREE cookbook of SQL queries and examples
>
SQL queries and examples
>
SQL - Questions and Answers
how can we assign rank to the in the result?
LinkBack
Thread Tools
Search this Thread
#
1
(
permalink
)
04-09-2007, 07:22 AM
rakhi sahgal
Posts: n/a
SQL 92
dialect question:
how can we assign rank to the in the result?
if there is a relation marks(student_id,score),then we have to assign a rank to each student according to their score.
rakhi sahgal
ANSWER(S):
#
2
(
permalink
)
04-30-2007, 02:07 PM
ben
Administrator
Join Date: Mar 2007
Posts: 93
ANY
answer.
Re: how can we assign rank to the in the result?
In MySQL you could do something like:
DO @a :=
0
then
SELECT
@a := @a +
1
AS
rank,
name,
score
FROM
students
ORDER
BY
score
ben
View Public Profile
Send a private message to ben
Find all posts by ben
«
The top x most popular whatever?
|
create one script that will combine multiple statements
»
Thread Tools
Search this Thread
Show Printable Version
Email this Page
Search this Thread
:
Advanced Search
Posting Rules
You
may not
post new threads
You
may not
post replies
You
may not
post attachments
You
may not
edit your posts
vB code
is
On
Smilies
are
On
[IMG]
code is
On
HTML code is
Off
Trackbacks
are
On
Pingbacks
are
On
Refbacks
are
On
All times are GMT. The time now is
11:32 PM
.
Contact Us
-
SQL Recipes
-
Archive
-
Top
Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by
vBSEO
3.0.0
Copyright (c) 2006-2008 SQL Recipes
LinkBack
LinkBack URL
About LinkBacks
Bookmark & Share
Digg this Thread!
Add Thread to del.icio.us
Bookmark in Technorati
Furl this Thread!
1
2
3
4
5
6
7
8