C # How to query Rownum in Mysql

Source: Internet
Author: User
C # How to query Rownum in Mysql. For more information, see

C # How to query Rownum in Mysql. For more information, see

SQL:

The Code is as follows:
SELECT
@ Rownum: = @ rownum + 1 AS rownum,
A. order_id,
Case when a. Ordered = 1 then 'split into tickets 'end as Ordered,
A. printed,
A. order_sn,
A. user_id,
B. user_name,
A. consignee,
A. tel,
A. mobile,
A. address,
A. pay_name,
A. goods_amount,
A. shipping_ing,
FROM_UNIXTIME (a. add_time + 8*3600 ),
A. postscript,
A. best_time
FROM (SELECT @ rownum: = 0) r, xj_order_info a inner join xj_users B on a. user_id = B. user_id
Where (order_status = '1') and (FROM_UNIXTIME (a. add_time) between' {0} 'and' {1 }')
Order by rownum asc

There is no problem with querying SQL statements in Navicat, but various errors are reported in the program.

I tried changing @ ?, You have also tried the parameter passing method, but none of them are successful.

Finally, the solution is found in StackOverflow:

Allow User Variables = True;

The problem is solved successfully.

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.