Please write a sql. We have a table with one column means (scores). We get a score from…
Jump to turn (6)
- 1Please write a sql. We have a table with one column means (scores). We get a sco
- 2Assuming the table name is “rocscores”, first column name is “scorevalue” and an
- 3thank you. but seems mysql version dont support window function means OVER.
- 4thak you. but in "rs.scorevalue", you dont define "ru" in anywhere
- 5thak you. but in “rs.scorevalue”, you dont define “rs” in anywhere
- 6mysql error #1054 - Unknown column 'rs.scorevalue' in 'field list'
- User
Please write a sql. We have a table with one column means (scores). We get a score from input means "my_score". We need show 11 records in table. 5 higher ranks from "my_score" and "my_score" and 5 lower ranks from "my_score" with rank number.
- Assistant
Assuming the table name is "scores_table", the column name is "scores", and the input score is stored in a variable called "my_score", you can use the following SQL query to display 11 records, including the 5 higher ranks and 5 lower ranks from "my_score" with their respective rank numbers:
sql