Microsoft
Software
Hardware
Network
Question : How to avoid duplicate record in Mysql
I have two questions:
1- My table has duplicate records eg. same symbol,date,time but value is different. How can I
delete these duplicate records?
2- How can I modify my table so that whenever I insert a record (index selected based on
symbol,date,time), the MySQL will reject those have the same index (combination of
symbol,date,and time)?
Thx,
XT
Answer : How to avoid duplicate record in Mysql
You need an unique index. You can do this in one operation:
alter ignore table TableName add unique index IndexName (`symbol`,`date`,`time`);
This will delete duplicates and create an unique index, preventing future inserts of duplicate rows.
Random Solutions
MS Reporting Services - Matrix Subtotal expression?
Eliminate rows in multiple table query
Using Interorg to replicate Public Folders and getting errors
Decommissioning domain controller, DNS, WINS and DHCP
Broadcom NICS WONT TEAM
Not All Desired Foreign Language Chars Shown
Does AOL log im conversations?
Virus; Spyware; Popups; Cookies
.Reg file not installing
Sports timing 00:00:00:00 and sql data types