Come in and help, database query problems

Source: Internet
Author: User
Experts come in and help. there is a table with customer information in the database query problem. we have set a specific order for these places and listed the table information in these order, for example: xiao Li Shanghai & nbsp; Xiao Zhang Xi'an, Shaanxi & nbsp; Xiao Yang Hongshan district of Wuhan & n experts come in to help with database query problems
There is a table containing the customer information. we have set specific order relative to these places and listed them in these order.
The table information is as follows: Xiao Li Shanghai
Xiao Zhang, Xi'an, Shaanxi province
Xiao Yang, Hongshan District, Wuhan
Xiaohuang Beijing
Xiaojin Xinjiang
Xiaohuang, Zhengzhou, Henan province
Zhou Tibet
The priority we set is Beijing, Shanghai, Wuhan, Xi'an, and Xinjiang.
The result is:
Xiaohuang Beijing
Xiao Li Shanghai
Xiao Yang, Hongshan District, Wuhan
Xiao Zhang, Xi'an, Shaanxi province
Xiaojin Xinjiang
Xiaohuang, Zhengzhou, Henan province
Zhou Tibet
There is a "ranking by region" button. Click this button to list the data in the table according to the above results. Pay attention to fuzzy search.

------ Solution --------------------
The quickest way is to check your priority data separately. Next, check the non-priority data. It's okay to combine the two.
------ Solution --------------------
1. you need to set a sort key field to sort by this field.
2. if the sorting order you need is the same as that of the administrative division code of the Ministry of Civil Affairs, you can directly use this sort to directly sort it to the county or district.

------ Solution --------------------
Add a new column and specify a value by region, such as Beijing 001 and Shanghai 002. sort the column values directly by 100000.

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.