如何从数据库中删除列无关紧要?
例如我有那张桌子
表人:
name | age |
------+-----+
James | 20 |
Smith | 25 |
James | 40 |
我想这样做:
delete from people
where name = 'James'
and age = *;
我知道我能做到:
delete from people
where name = 'James'
但我不需要这个
答案 0 :(得分:2)
尝试:
DELETE FROM people where
name like '%personsname%'
答案 1 :(得分:0)
如果您要引用一个可以为NULL的参数,那么就像这样使用它
delete from people
where name = @nameParam
and (@ageParam is null or age = @ageParam)