首頁  >  文章  >  資料庫  >  mysql使用union的注意點是什麼

mysql使用union的注意點是什麼

王林
王林轉載
2023-06-03 20:04:011708瀏覽

1、union運算子用來連接兩個以上的select語句的結果組合到一個結果集合。多個select語句會刪除重複的資料。

2、使用時union合併結果集時,要求兩個結果集的列數相同。

實例

select playerno, town
from PLAYERS
where town = 'Inglewood'
union
select playerno, town
from PLAYERS
where town = 'Plymouth';

以上是mysql使用union的注意點是什麼的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:yisu.com。如有侵權,請聯絡admin@php.cn刪除