CREATE TABLE a (
id VARCHAR(32)
) DEFAULT CHARSET = utf8 COLLATE utf8_general_ci;
INSERT INTO a(id) VALUES('a');
CREATE TABLE b (
id VARCHAR(32)
) DEFAULT CHARSET = utf8 COLLATE utf8_general_ci;
INSERT INTO b VALUES('b');
CREATE TABLE c (
id VARCHAR(32)
) DEFAULT CHARSET = utf8 COLLATE utf8_unicode_ci;
INSERT INTO c VALUES('c');
SELECT DISTINCT a.id,b.id FROM a,b WHERE a.id=b.id ORDER BY a.id DESC,b.id DESC;
SELECT CONCAT('ALTER TABLE ','c',' CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;') FROM information_schema.TABLES WHERE TABLE_SCHEMA='test001';
ALTER TABLE c CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
SELECT DISTINCT a.id,b.id,c.id FROM a,b,c WHERE a.id=b.id AND b.id=c.id ORDER BY a.id DESC,b.id DESC,c.id DESC;