SQL查询选择除一个以外的所有行

时间:2013-07-22 20:09:30

标签: php mysql sql database

我想选择表jogos中的所有内容,但intCategoria为11的行除外。

$query_GameData = sprintf("SELECT * FROM `jogos` ORDER BY  RAND()");

2 个答案:

答案 0 :(得分:5)

SELECT *
FROM `jogos`
WHERE intCategoria <> 11
ORDER BY RAND()

答案 1 :(得分:2)

只需使用WHERE子句:

$query_GameData = sprintf("SELECT * FROM `jogos` where intCategoria != 11  ORDER BY RAND() ");