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_TYPE存在不添加 与卡一起插入其他新卡号键入mysql插入不存在语法错误。我不知道什么是错的
我很难与插入某个数字不存在的表中。
即时得到这个错误:
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
谢谢大家提前帮助我:)
创建'CARD_NUMBER + card_type'领域 – zerkms 2012-04-25 02:15:41
的事情是,卡类型设置为仅几类,是不是唯一的唯一索引....数量也可以相同与不同的类型....我只是想它,以便它检查是否存在卡类型和卡号存在作为记录 – user1235103 2012-04-25 02:39:07