我正在尝试使用PHP对MSSQL表进行查询,该表将找到列不等于某个值的行。
我目前正在使用这个:
$selecting6 = "select * from used_trailers1 where photo1='".$picature2."' or photo='".$picature2."' or name='".$picature2."' or photo2='".$picature2."' or photo3='".$picature2."' or photo4='".$picature2."' and Orderid isnot '".$id."'";
无效,此代码无效。
可以使用哪些正确的代码来选择不具有$id
的值的行?
感谢您的帮助。感谢所有帮助。
答案 0 :(得分:1)
试试这个
$selecting6 = "select * from used_trailers1 where (photo1='".$picature2."' or photo='".$picature2."' or name='".$picature2."' or photo2='".$picature2."' or photo3='".$picature2."' or photo4='".$picature2."') and Orderid !='".$id."'";
答案 1 :(得分:1)
SQL标准中的不等运算符是<>
但MySQL和SQL Server也支持!=
。阅读Comparison Operators in SQL Server Comparison Functions and Operators in MySQL。
SELECT [*] FROM [tbl] WHERE id <> $id