union and union all

Oh, by the way, I also learned the sql keyword union today.

If we need to display the results of the two select statements as a whole, we need to use the union or union all keywords. The role of union (or union) is to combine multiple results and display them together.

Union is inefficient because it needs to scan for repeated values. If the merge does not deliberately delete duplicate rows, then use Union All,

the number of fields in the two SQL statements to be combined must be the same, and the field types must be "compatible" (consistent);



from: http://www.cnblogs.com /xiangshu/articles/2054447.html

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326678408&siteId=291194637