Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Re-stating a problem more clearly.....help most appreciated 1

Status
Not open for further replies.

glrpfi

IS-IT--Management
Nov 15, 2002
51
US
An sql application we are developing has a simple function they've designed, but we are failing to get the query built...perhaps someone could suggest something...
========
Table Persona_data

ID numeric Persona ID
IND numeric Data element number (1-data.maxrecord)
VALUE numeric

Primary Key is combination of unique ID and IND

No null values

basically the ID is the unique number for each persona. There are 50 overall IND elements for each ID. We are only dealing with two here.

the IND are various data elements about each ID.

for this excercise ID.12 is the player score and id.15 is the player ranking.

so id.12.value is the actual score
id.15.value is the ranking.

the query needs to sort all id.12.values and set the corresponding id.15.values to a 1-whatever ranking based on highest score to lowest...
 
That can't be done without correlated subqueries, which is not currently supported in a production version of Mysql.

What you can do is to retrieve the data ordered by score and keep track while looping through your data in the application and update each record individually with the correct rank value.
 
Thanks Much Swampboogie! I was afraid I had reverted to first year programmer when I could not manage it straight away...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top