|
-
Jan 20th, 2008, 03:50 AM
#1
Thread Starter
Fanatic Member
check before insert data in mysql
Hi,
How to do this check entry if exist or not then if not do insert data entry to mysql database.
BR
-
Jan 22nd, 2008, 02:22 PM
#2
Fanatic Member
Re: check before insert data in mysql
-
Jan 22nd, 2008, 02:52 PM
#3
Re: check before insert data in mysql
INSERT INTO tbl_name (a,b,c) VALUES(1,2,3) where id not in (select id from tbl_name);
Should do what you're looking for. It's not tested though.
-
Jan 23rd, 2008, 08:41 AM
#4
Re: check before insert data in mysql
It is better though to use a query to check it exists first.
SELECT NULL FROM ID tbl_name WHERE id=1
If you have one record you know it is in there
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|