---
title: "union all 和union的区别"
author: "cherryQQ"
date: "2013-07-25T16:30:04Z"
tags: []
categories: ["数据库"]
slug: "union-all-union"
draft: false
lastmod: "2013-07-25T16:30:04Z"
id: 1913553
url: "https://cherryqq.iteye.com/blog/1913553"
---

今天检查了一下写的视图，发现数据不对，数据量相差不是一个数量级的

 

后面看到，union all 连接，被写成 union啦 晕倒

 

 

union ：排除重复的数据

 

union all ：保留所有的数据记录