我有一个sql表,如下所示
+---+-------+-----+
|Sl | Name |Value|
+---+-------+-----+
| 1 | Name1 | 1 |
| 2 | Name2 | 2 |
| 3 | Name3 | 2 |
| 4 | Name4 | 3 |
| 5 | Name5 | 4 |
+---+-------+-----+
我有一个php查询$query3 = "select * from table";
查询返回所有行和我需要的列。但我想在“Value”列中排除值为2的行,如下所示;
+---+-------+-----+
|Sl | Name |Value|
+---+-------+-----+
| 1 | Name1 | 1 |
| 4 | Name4 | 3 |
| 5 | Name5 | 4 |
+---+-------+-----+
答案 0 :(得分:0)
SELECT `Sl`, `Name`, `Value` from `table` WHERE `Value` != 2