Reputation: 954
With the following, CHECKINDATEENTERED
will always be different but VENUECREATEDAT
will always be the same.
I was wondering if it would be possible for me to prevent duplicate entries by checking only one column in the table createdAt
.
SQL = "INSERT IGNORE INTO CHECKINS (CHECKINPLATFORM, MEMBERID, VENUENAME, VENUELAT, VENUELNG, VENUECITY, VENUECOUNTRY, VENUECREATEDAT, CHECKINDATEENTERED) VALUES ('"& strFoursquare &"', '"& objMembers("MEMBERID") &"', '"& strVenueName &"', '"& strlat &"', '"& strlng &"', '"& strCity &"', '"& strCountry &"', '"& FormatDateMySQL(strcreatedAt) &"', '"& FormatDateMySQL(NOW) &"')"
Upvotes: 0
Views: 262
Reputation: 211560
If you have a UNIQUE INDEX
then entries that conflict on this key will be ignored. You need to establish your "duplicate" conditions by creating an index on the specific columns relevant to their unique identity.
Upvotes: 1