The SQL statement is
Select A.username, (@rowNum: = @rowNum + 1) as c,a.integral as integral from Xs_user A, (Select (@rowNum: =0)) b Order by Integral DE Sc,time
How do I query the user's user name and integral based on this SQL statement?
Or how to get it in PHP?
Reply to discussion (solution)
Know the user name, direct select User name, points from table where username = user name No, it's done.
?? Out of the table??。
SELECT * FORM ( select A.username, (@rowNum: = @rowNum + 1) as c,a.integral as integral from xs_user A, (select (@rowNum : =0)) b Order by Integral Desc,time ) T WHERE username= ' XXX '
This definition of user variables is still very clever.
SELECT * FORM ( select A.username, (@rowNum: = @rowNum + 1) as c,a.integral as integral from xs_user A, (select (@rowNum : =0)) b Order by Integral Desc,time ) T WHERE username= ' XXX '
This definition of user variables is still very clever.
SELECT * FROM ( select A.username, (@rowNum: = @rowNum + 1) as c,a.integral as integral from xs_user A, (select (@rowNum : =0)) b Order by Integral Desc,time ) T WHERE username=18511337033 '
In this case, plus the Where condition will be an error, no where condition is normal.
Here is the error message.
[SQL] SELECT * FROM ( select A.username, (@rowNum: = @rowNum + 1) as c,a.integral as integral from xs_user A, (select (@rowNum : =0)) b Order by Integral Desc,time ) T WHERE username=18511337033 ' [ERR] 1064-you has an error in your SQL syntax ; Check the manual-corresponds to your MySQL server version for the right syntax-to-use "at line 6
This is the table structure
SELECT * FORM ( select A.username, (@rowNum: = @rowNum + 1) as c,a.integral as integral from xs_user A, (select (@rowNum : =0)) b Order by Integral Desc,time ) T WHERE username= ' XXX '
This definition of user variables is still very clever.
I read it wrong. It's my own problem. Sorry. 3Q Thank you.