Home > Backend Development > PHP Tutorial > sql multi-condition query

sql multi-condition query

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-10-18 08:41:53
Original
1408 people have browsed it

To implement multi-condition query, when the value is 0, it is unrestricted. How to use sql to achieve it

For example: when querying a certain type of store in a certain area, it is possible that the area is unlimited and the type is Chinese food. When querying, there is no need for where region = value, but only where type = Chinese food. When selecting the area as Beijing, the type is Chinese food. When querying, it is where region = Beijing. AND type=Chinese food.

Then there are many other conditions. It is too cumbersome to use if else to judge on the backend and then use different sql statements to query. I don’t know much about sql, but I think sql should have corresponding solutions. Please give me some advice.

Related labels:
source:php.cn
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
sql file
From 1970-01-01 08:00:00
0
0
0
php - Overhead of prepare vs sql?
From 1970-01-01 08:00:00
0
0
0
Print sql statement
From 1970-01-01 08:00:00
0
0
0
Pass array to SQL insert query using PHP
From 1970-01-01 08:00:00
0
0
0
sql optimization or
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