过滤表mysql也使用多个列

时间:2015-05-07 06:11:51

标签: php mysql filtering between sql-like

如何使用多个类别加入 BETWEEN 语句和 AND 语句?

SELECT * FROM quick_inquiry WHERE inquiry_time BETWEEN '$start' AND  '$end' AND
  inquiry_language LIKE '%$language%' AND
  service_country LIKE '%$country%' AND
  category LIKE '%$category%' AND
  replied LIKE '%$replied%'

1 个答案:

答案 0 :(得分:1)

试试这个:

SELECT * FROM quick_inquiry
WHERE (inquiry_time BETWEEN '$start' AND '$end')
AND inquiry_language LIKE '%$language%'
AND service_country LIKE '%$country%'
AND category LIKE '%$category%'
AND replied LIKE '%$replied%'

您也可以使用> =和< =

SELECT * FROM quick_inquiry
WHERE inquiry_time >= '$start'
AND inquiry_time <= '$end'
AND inquiry_language LIKE '%$language%'
AND service_country LIKE '%$country%'
AND category LIKE '%$category%'
AND replied LIKE '%$replied%'