MySQL Federated Query Union

Source: Internet
Author: User

Remember a very long SQL, in order to facilitate reading, I have added the paragraph:

 SELECT *  from (   (SELECT 1  asAcheck, S1.id, S1.plan_name, S1.cost_mode, S1.sta_type, S1.cost_type, S1.cost_period_time, S1.cost_period_value, S1. ' Carrier_operator ', S1.cost_settle_type fromWo_serviceplan S1JOINWo_serviceplan_hotspot SH onS1.id=sh.serviceplan_idWHERES1.is_enable= 1  andsh.hotspot_id= 109 ORDER  byS1.plan_nameASC )   UNION  All   (SELECT 2  asAcheck, S2.id, S2.plan_name, S2.cost_mode, S2.sta_type, S2.cost_type, S2.cost_period_time, S2.cost_period_value, S2. ' Carrier_operator ', S2.cost_settle_type fromWo_serviceplan S2WHERES2.is_enable= 1  andS2.id not inch(SELECTserviceplan_id fromWo_serviceplan_hotspotWHERE 1=1   andhotspot_id= 109 )  ORDER  byS2.plan_nameASC) ) asS3ORDER  byS3.acheckASC, S3.plan_nameASCLIMIT0, -

MySQL Federated Query Union

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.