sql - duplicates
Posted
by
Sebastjan
on Stack Overflow
See other posts from Stack Overflow
or by Sebastjan
Published on 2011-01-12T11:39:40Z
Indexed on
2011/01/12
11:54 UTC
Read the original article
Hit count: 153
Hey guys
I'm putting data from website (json) to sql base. In db i have these rows.
ID | PostId | Name | Message
Id is auto-increment primary key. PostId also has a unique values. Name and Message are nothing special.
When I run my script / click on the button in form / ... , the program saves all the values into database (lets say there are 25). Next time I'm going to press the button there will be added 25 more records (all duplicates), and so on...
Is there a way that the program can check through 'PostIds' if the value already exists before adding it to the db?
Thanks
© Stack Overflow or respective owner