How to query this SQL statement

Source: Internet
Author: User
Help: how does this SQL query PHPcode10 representative clothes 20 representative digital 30 representative furniture second-level classification 1001 representative men's clothes 1002 representative women's clothes 2001 representative digital 12002 representative digital 2 third-level classification 100201 representative women's underwear 10020 help: how to query this SQL statement
PHP code
  10 stands for clothes 20 stands for digital 30 stands for second-level classification of furniture 1001 stands for men's clothes 1002 stands for women's clothes 2001 stands for Digital 12002 stands for Digital 2 third-level classification 100201 stands for women's underwear 100202 stands for women's women ......


The database has such a category ID.
How can I write the value of the second-level classification under 10? I write select * typetabe where family_id like "10%" in this way"
In this way, we can write all the categories. what I want is how to write it as long as it has a second-level classification.
That is, only the data I want to query.
1001 represents men's clothes
1002 women's clothes



------ Solution --------------------
Select * typetabe where family_id like "10%" and length (family_id) = 4
------ Solution --------------------
All of the first-level classification like '20160301' is 10.
Like '10' with a level-1 Classification of 10
Like '10 ?? 'Level-1 classification is 10 level-2 classification
.....

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.