Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,255
Total Threads: 81,222
Total Posts: 566,958
There are 190 users currently browsing (tf).
  Our Partners:
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

Duplicate entries on a unique key?

Thread title: Duplicate entries on a unique key?
    Thread tools Search this thread Display Modes  
06-18-2012, 03:56 PM
Dan is offline Dan
Dan's Avatar
Status: Request a custom title
Join date: Feb 2005
Posts: 3,164
iTrader: 15 / 86%

Dan is an unknown quantity at this point

  Old  Duplicate entries on a unique key?

ALTER TABLE  `users votes`,
ADD UNIQUE  `voting key` (  `userid` ,  `forumtopicid`  ,  `replyid`   )

Shouldn't the above prevent duplicate entries of userid, forumtopicid and replyid together?!?

If I seperate "voting key" into two uniques: userid & forumtopicd; userid & replyid. Then it works perfectly but I can't shake the feeling that it could and should be done on 1 unique key.

Reply With Quote
07-17-2012, 12:44 PM
#2 is offline
Status: I'm new around here
Join date: Jul 2005
Location: Chennai India
Posts: 3
iTrader: 0 / 0% is on a distinguished road


I guess you need to add some type of CONSTRAINT for this to work ?

Reply With Quote

Thread Tools
Display Modes

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed