Created
November 27, 2012 09:19
-
-
Save rubyonrailsworks/4153287 to your computer and use it in GitHub Desktop.
MYSQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT `tid`, DATE_ADD(`send_goods_at`, INTERVAL 8 HOUR) FROM `taobao_orders` WHERE `tid` IN ('166766380536047', '166789906978402') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
delete from table1 | |
USING table1, table1 as vtable | |
WHERE (NOT table1.ID=vtable.ID) | |
AND (table1.field_name=vtable.field_name) | |
1. Here you tell mysql that there is a table1. | |
2. Then you tell it that you will use table1 and a virtual table with the values of table1. | |
3. This will let mysql not compare a record with itself! | |
4. Here you tell it that there shouldn’t be records with the same field_name. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment