There is an integral table, where the points are arranged down from the top to the bottom, and how to retrieve the ranking of one of the users, the integral SQL statement is
Select. username, (@ rowNum: = @ rowNum + 1) as c,. integral as points from xs_user a, (Select (@ rowNum: = 0) B order by integral DESC, time
On the basis of this SQL statement, how can I query the user name and points.
Or how can I get it in php?
Reply to discussion (solution)
Do you know the user name? directly select the user name, Points from table where user name = user name. isn't that all done?
?? Output Table ??.
SELECT * FORM (select. username, (@ rowNum: = @ rowNum + 1) as c,. integral as points from xs_user a, (Select (@ rowNum: = 0) B order by integral DESC, time) T WHERE username = 'XXX'
This method of defining user variables is clever.
SELECT * FORM (select. username, (@ rowNum: = @ rowNum + 1) as c,. integral as points from xs_user a, (Select (@ rowNum: = 0) B order by integral DESC, time) T WHERE username = 'XXX'
This method of defining user variables is clever.
SELECT * From (select. username, (@ rowNum: = @ rowNum + 1) as c,. integral as points from xs_user a, (Select (@ rowNum: = 0) B order by integral DESC, time) T WHERE username = 18511337033'
In this case, an error will be reported when the where condition is added, and it will be normal if no where condition is available.
Below is the error message.
[SQL] SELECT * From (select. username, (@ rowNum: = @ rowNum + 1) as c,. integral as points from xs_user a, (Select (@ rowNum: = 0) B order by integral DESC, time) t where username = 18511337033 '[Err] 1064-You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''' at line 6
This is the table structure
SELECT * FORM (select. username, (@ rowNum: = @ rowNum + 1) as c,. integral as points from xs_user a, (Select (@ rowNum: = 0) B order by integral DESC, time) T WHERE username = 'XXX'
This method of defining user variables is clever.
I saw it wrong .. It's my own problem .. .. 3Q thanks.