我想做一个mysql选择,但我需要选择两种类型的数据,一个从0256开始,另一个用0356.我可以使用:
SELECT * FROM table WHERE tel LIKE '0256%' AND '0356%'
?
谢谢,塞巴斯蒂安
编辑
我在PHP中遇到这些查询的问题.上面的查询,在mysql中工作正常,但在PHP中我只得到结果LIKE '0256%'
Gre*_*reg 11
您可能正在寻找这样的查询:
SELECT * /* Select all columns */
FROM table /* from the table named 'table' */
WHERE tel LIKE '0256%' /* where the field 'tel' starts with '0256' */
OR tel LIKE '0356%' /* or where the field 'tel' start with '0356' */
Run Code Online (Sandbox Code Playgroud)