在公司看老大写的代码时,无意中看到这样一句where 1,很不理解,自己查找资料,大致明白了这样写的用意:这种写法主要是在多条件拼接查询时用到:
where 1 条件1 条件2…..
eg:where 1 and name=’$name’ and password=’$pwd’
如果没有‘where 1’,第一条拼接语句不能有and,不然就成了where and…则发生错误。
mysql中where=1的理解
最新推荐文章于 2024-02-01 13:23:29 发布