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

这条sql如何查询

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 10:25:41
Original
1038 people have browsed it

求助: 这条sql怎么查询

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->10 代表衣服20 代表数码30 代表家具二级分类1001 代表男式衣服1002 代表女式衣服2001  代表数码12002 代表数码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