Home > Backend Development > PHP Tutorial > 这条sql如何查询

这条sql如何查询

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 13:29:15
Original
862 people have browsed it

求助: 这条sql怎么查询

PHP code

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

<!--

 

Code highlighting produced by Actipro CodeHighlighter (freeware)

http://www.CodeHighlighter.com/

 

-->

10 代表衣服

20 代表数码

30 代表家具

 

二级分类

1001 代表男式衣服

1002 代表女式衣服

 

2001  代表数码1

2002 代表数码2

三级分类

 

100201 代表女式内衣

100202 代表女式……

Copy after login


数据库有这样的分类ID
我要查询 10 下面的二级分类的值 我应该怎么写呢 我这样写select * typetabe where family_id like "10%" 
这样写得到的是全部分类,而我要的只要它的二级分类而己,我应该怎么写呢。
也就是我要查询的数据只要。
1001 代表男式衣服
1002 代表女式衣服



------解决方案--------------------
select * typetabe where family_id like "10%" and length(family_id)=4
------解决方案--------------------
like '10%' 一级分类为 10 的全部
like '10' 一级分类为 10 的
like '10??' 一级分类为 10 的二级分类
.....
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Django's LIKE operation.
From 1970-01-01 08:00:00
0
0
0
Isn’t this iQiyi-like course finished? ?
From 1970-01-01 08:00:00
0
0
0
javascript - js cannot retrieve objects like this
From 1970-01-01 08:00:00
0
0
0
Why should I write it like this?
From 1970-01-01 08:00:00
0
0
0
How to open a developer tool like yours
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template