I want to teach you a question about the mysql_query function. to do this, set @ mycnt = 0; select (@ mycnt: = @ mycnt + 1) asrank, nick_name, total_scores, start_time, expire asks for a question about the mysql_query function.
Used for ranking
Set @ mycnt = 0;
Select (@ mycnt: = @ mycnt + 1) as rank, nick_name, total_scores, start_time, expire_time from of_user_exam left join of_user_basic on limit = Sort order by-total_scores, expire_time;
There are two such sentences, but they cannot be executed using mysql_query in a single string. Is there any other way to get the result?
------ Solution --------------------
What is the meaning of mycnt? if it is a sequence number like 1, 2, 3, 4, 5, 6, 7, 8, why should it be in an SQL statement?
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service