Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,471
There are 1066 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?
Reply    
    Thread tools Search this thread Display Modes  
06-18-2012, 03:56 PM
#1
Dan is offline Dan
Dan's Avatar
Status: Request a custom title
Join date: Feb 2005
Location:
Expertise:
Software:
 
Posts: 3,164
iTrader: 15 / 86%
 

Dan is an unknown quantity at this point

  Old  Duplicate entries on a unique key?

Code:
ALTER TABLE  `users votes`,
ADD UNIQUE  `voting key` (  `userid` ,  `forumtopicid`  ,  `replyid`   )
http://i.imgur.com/PUzJY.png

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
chrisranjana.com is offline chrisranjana.com
Status: I'm new around here
Join date: Jul 2005
Location: Chennai India
Expertise:
Software:
 
Posts: 3
iTrader: 0 / 0%
 

chrisranjana.com is on a distinguished road

  Old

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

Reply With Quote
Reply    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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