从MySql查询中排除结果

Kap*_*ius 1 mysql sql

我有一个类似这样的Select查询

SELECT * FROM table WHERE id = ?
Run Code Online (Sandbox Code Playgroud)

我需要一个排除特定结果的条件. if(type = 'tv' and that type's code = '123') 然后从选择结果中排除该行.由于我的SQL技能不是很强,我不确定如何实现这一点.

Akh*_*hil 8

SELECT * FROM table WHERE  id = ? AND not(type = 'tv' and code = '123')
Run Code Online (Sandbox Code Playgroud)

这是你要找的?

type <> 'tv' and code <> '123' 和 之间有区别 not(type = 'tv' and code = '123')