Thinkphp encountered ranking and paging issues during query

Source: Internet
Author: User
When the two tables are joined to query the data, the ranking will be affected by the page, and the ranking will only be performed on the current page. how can this problem be solved?

When the two tables are joined to query the data, the ranking will be affected by the page, and the ranking will only be performed on the current page. how can this problem be solved?

Reply content:

When the two tables are joined to query the data, the ranking will be affected by the page, and the ranking will only be performed on the current page. how can this problem be solved?

The total_bean field is added to the oc_member table and is updated at any time.

Create a View. because the SQL statements are complex and the TP support is poor, make the complex SQL statements into a view, simplify the SQL statements executed in the TP, and then obtain the results through the view query in the TP.
$ Model = D ("BlogView ");
$ Model-> where ($ where)-> page ($ page, $ end)-> select ();

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.