Andre Polykanine wrote:
> Hello Rolando,
> So if I do
> "INSERT IGNORE INTO `Votes` SET `EntryId`='12345', UserId`='789'";
> it *won't* insert the second row if there's a row with EntryId set to
> 12345 and UserId set to 789?
If you want to have at most one vote per user on any entry, IMO you
should have a "unique index" on that combination of fields.
Assuming you "*Id" values are numeric types, you should stop using
quotes around them: quotes enclose strings.
I know MySQL implicitly converts numbers to strings and vice versa, but
this costs performance and IMO is a bad idea anyways.
I feel a programmer should know the distinction of numeric and string
types and keep them separate in a well-structured application.
Joerg Bruehe, MySQL Build Team, joerg.bruehe@stripped
ORACLE Deutschland B.V. & Co. KG, Komturstrasse 18a, D-12099 Berlin
Geschaeftsfuehrer: Juergen Kunz, Marcel v.d. Molen, Alexander v.d. Ven
Amtsgericht Muenchen: HRA 95603