insert into creditcard_info (member_id,card_type,card_number)
values ('1','Discover','555')
where not exists (
select * from creditcard_info
where card_number='555' and
card_type='Discover')
我希望能够检查卡号是否已经存在。如果 card_number 存在并且 card card_type 存在则不要添加否则将这个新卡号与卡类型一起插入
我很难插入不存在某个数字的表中。
我收到此错误:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL
server version for the right syntax to use near 'where not exists (select * from
creditcard_info where card_number='555')' at line 2
提前谢谢大家帮助我:)