where 1=1有什么用?在SQL语言中,写这么一句话就跟没写一样。
select * from table1 where 1=1与select * from table1完全没有区别,甚至还有其他许多写法,12,’a’=’a’,’a'’b’,其目的就只有一个,where 的条件为永真,得到的结果就是未加约束条件的。
在SQL注入时会用到这个,例如select * from table1 where name=’lala’给强行加上select * from table1 where name