Database-php first queries by year in reverse order and then queries by the first query of 1 after the first query of 2 by term

Source: Internet
Author: User
{Code ...} for example, if you first query in the inverted order of year, and then query by the first query as 1 of term 2, it is best to use thinkphp to find out such {code ...}
Array(    [id] => 1    [user_id] => 1    [year] => 2013-2014    [term] => 1)Array(    [id] => 2    [user_id] => 1    [year] => 2013-2014    [term] => 2)Array(    [id] => 3    [user_id] => 1    [year] => 2012-2013    [term] => 1)

For example, if you first query in the inverted order of year, and then query by the first query of the term of 2 is 1, it is best to use thinkphp
This is the case.

Array(    [id] => 2    [user_id] => 1    [year] => 2013-2014    [term] => 2)Array(    [id] => 1    [user_id] => 1    [year] => 2013-2014    [term] => 1)Array(    [id] => 3    [user_id] => 1    [year] => 2012-2013    [term] => 1)

Reply content:
Array(    [id] => 1    [user_id] => 1    [year] => 2013-2014    [term] => 1)Array(    [id] => 2    [user_id] => 1    [year] => 2013-2014    [term] => 2)Array(    [id] => 3    [user_id] => 1    [year] => 2012-2013    [term] => 1)

For example, if you first query in the inverted order of year, and then query by the first query of the term of 2 is 1, it is best to use thinkphp
This is the case.

Array(    [id] => 2    [user_id] => 1    [year] => 2013-2014    [term] => 2)Array(    [id] => 1    [user_id] => 1    [year] => 2013-2014    [term] => 1)Array(    [id] => 3    [user_id] => 1    [year] => 2012-2013    [term] => 1)

ORDERKeywords can be assigned to multiple fields.

ORDER BY `year` DESC, `term` DESC

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.