《MYSQL教程MySQL实现差集(Minus)和交集(Intersect)测试报告》要点:
本文介绍了MYSQL教程MySQL实现差集(Minus)和交集(Intersect)测试报告,希望对您有用。如果有疑问,可以联系我们。
可以用SQL实现同样的功能,就是麻烦了点.MYSQL应用
drop table t1; drop table t2; create table t1(id int primary key,nickname varchar(20),playNum varchar(20)); create table t2(id int primary key,nickname varchar(20),playNum varchar(20)); insert into t1 values(1,1,10); insert into t1 values(2,2,20); insert into t1 values(3,3,30); insert into t2 values(1,1,10); insert into t2 values(2,2,200); insert into t2 values(3,33,300); commit;
MYSQL应用
MySQL实现交集MYSQL应用
MYSQL应用
SELECT id, nickname, playNum, COUNT(*) FROM (SELECT id, nickname, playNum FROM t1 UNION ALL SELECT id, nickname, playNum FROM t2 ) a GROUP BY id, nickname, playNum HAVING COUNT(*) > 1
MYSQL应用
MySQL实现差集MYSQL应用
MYSQL应用
SELECT t1.id, t1.nickname, t1.playNum FROM t1 LEFT JOIN t2 ON t1.id = t2.id WHERE t1.nickname != t2.nickname OR t1.playNum != t2.playNum;
MYSQL应用
转载请注明本页网址:
http://www.vephp.com/jiaocheng/3456.html