MySQL Forums
Forum List  »  Newbie

Insert unique keys with two KEY fields
Posted by: Robbie Byrd
Date: April 11, 2005 11:20AM

Hello,

I'm having a little trouble here... I'm writing an app in Coldfusion that inserts a serial number of an mp3 into a table called tbl_songs_playlist. The table contains three fields, fld_song, fld_playlist, and fld_serial. fld_Serial is an auto-increment (which obviously means it must be a key) and the other two fields are int. fld_song is also a key. How would I insert a unique value for fld_song? This is a sample SQL statement generated by my Coldfusion app that demonstrates the problem:

REPLACE INTO tbl_playlist_songs (fld_Playlist,fld_Song) VALUES ('1', '935'), ('1','935'), ('1','935');

I tried INSERT with the ON DUPLICATE KEY UPDATE fld_song = fld_song, but didn't get any different results. My table looks like this after doing either the REPLACE or the INSERT with the ON DUPLICATE KEY:

fld_playlist fld_song fld_serial
1 729 1
1 729 2
1 729 3

Any help would certainly be appreciated.

RB

Options: ReplyQuote


Subject
Written By
Posted
Insert unique keys with two KEY fields
April 11, 2005 11:20AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.