查詢同一張表就把table寫成一樣
查詢交集,由於mysql不支援intersect,可以使用以下方案:
select * from
(select * from table where val = 10 ) as t1
inner join
(select * from table where val = 11) as t2
where t1.id = t2.id
查詢並集(union all 或 union)
select * from table where val = 10
union all
select * from table where val = 11
查詢差集
/**
*t1和t2都可以是select查詢語句也可以是具體的表
**/select * from table as t1
left join table as t2 on t1.v = t2.v where t2.v is null
交集並集差集
1 內連線 select from student a inner join sc b on a.sno b.sno 左連線 select from student a left join sc b on a.sno b.sno 差集 select sno from student except s...
shell bash 交集 並集 差集
方法一 直接用檔名 取兩個文字檔案的並集 交集 差集 並 sort m sort file1 uniq sort file2 uniq uniq 交 sort m sort file1 uniq sort file2 uniq uniq d 差 file1 file2 sort m sort fil...
PHP 交集 並集 差集
array flip array splice 並集 array merge 過濾 array filter 去重 array unique 差集 array diff array diff 函式返回兩個陣列的差集陣列。該陣列包括了所有在被比較的陣列中,但是不在任何其他引數陣列中的鍵值。a1 arr...