sql multi-condition query

WBOY
Release: 2016-10-18 08:41:53
Original
1342 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!