How do you rank the mysql sentence?

Source: Internet
Author: User
How do you order the MySQL sentence?
SELECT * from the text where (' title ' like '% of us% ' and ' title ' like '% of them% ') or (' title ' like '% US% ' or ' title ' like '% of them% ') Lim It 6

Is there a way to first put the previous condition (' title ' like '% of us% ' and ' title ' as '% of them% ') listed to come up in the list below?

------Solution--------------------
Give it a try?
SQL code
select *, ((' title ' like '% US% ' and ' title ' like '% of them% ') * 0.8 + (' title ' like '% of us% ' or ' title ' like '% of them% ') * 0.2) as Relevancefrom textwhere (' title ' like '% US% ' and ' title ' L Ike '% of them% ') or (' title ' like '% of us% ' or ' title ' like '% of them% ') ORDER by relevance Desclimit 6 
------Solution------------------ --
SQL code
select * FROM (SELECT * from ' text ' WHERE ' title ' like '% of us% ' and ' title ' like '% of them% ') Ttwhere ' title ' like '% of us% ' or ' title ' like '% of them% ' limit 6; 
------Solution--------------------
SQL code
selec T *, 1 as XH from the text where (' title ' like '% of us% ' and ' title ' like '% of them% ') Unionselect *, 2 as XH from text where (' title ' Like '% we% ' or ' title ' like '% of them% ') Order by Xhlimit 6 
  • 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.