当前位置:网站首页>Bi-sql Union
Bi-sql Union
2022-06-25 01:12:00 【Powerbi white tea】

UNION sentence
UNION Statement similar to PowerQuery Append query in , You can merge two tables or two datasets up and down .DAX There's also... In the function UNION, And the usage is very similar .
UNION Use requires the same number of columns in both datasets , The data types of the two dataset columns are exactly the same , And the order of columns should be consistent .
except UNION outside , also UNION ALL sentence . The difference between the two is that the data set returned by the former has no duplicates , The data set returned by the latter contains duplicates .
Basic grammar
UNION grammar :
SELECT Column name (s) FROM surface 1
UNION
SELECT Column name (s) FROM surface 2
UNION ALL grammar :
SELECT Column name (s) FROM surface 1
UNION ALL
SELECT Column name (s) FROM surface 2
Using examples
Case data :


In the database of white tea machine , There is a name “TEST” The database of , There is a name “ Babies ” and “ Mixed class ” Case data for .
Example 1:
stay PowerBI Use in UNION Statement to merge two tables .
SELECT * FROM Babies
UNION
SELECT * FROM Mixed class

give the result as follows :

Example 2:
stay PowerBI Use in UNION ALL Statement to merge two tables .
SELECT * FROM Babies
UNION ALL
SELECT * FROM Mixed class

give the result as follows :

Contrast examples 1 We can easily find the result of , Duplicate items of mixed classes are preserved .
Example 3:
stay PowerBI Use in UNION Statement to convert... In two tables [ Classification of goods ] Column to merge .
SELECT Classification of goods FROM Babies
UNION
SELECT Classification of goods FROM Mixed class

give the result as follows :

Example 4:
stay PowerBI Use in UNION Statement to the infant class [ Classification of goods ] Columns and mixed classes [ The sale price ] Column to merge .
SELECT Classification of goods FROM Babies
UNION
SELECT The sale price FROM Mixed class

give the result as follows :

Because the column data types in the two datasets are different , So the result is an error .
Have a chat :
about PowerBI The cognitive , White tea prefers to be called a container 、 platform .
Compare with others BI For class software , Microsoft PowerBI More compatible , Compatible with many other languages .
for instance :Python、R Language 、SQL Language 、Mysql Language, etc. .
So the partners used other languages in the development process , Be sure to pay attention to some development specifications and detailed requirements of the language .
because PowerBI As a platform, it can be compatible with these languages , It is also required to follow the original requirements of these languages .
for instance :Mysql To distinguish between keywords and ordinary characters , Backquotes introduced . And in the SQL Server There is no concept of backquotes in , Only single quotation marks . So we have PowerBI Use in SQL When querying , These details also need to be observed .


This is white tea , One PowerBI Beginners .
边栏推荐
- I 刷题 I — 复制带随机指针的链表
- adb shell getevent
- JS Chapter 1 Summary
- Cobalt strike installation tutorial
- Text border format and text block of rich text
- 【直播回顾】2022腾讯云未来社区城市运营方招募会暨SaaS 2.0新品发布会!
- Bi-sql like
- [practical series] full WiFi coverage at home
- adb shell sendevent
- Leetcode 1248. Statistics of "graceful subarray" (harm, suddenly found that it can only enumerate violently)
猜你喜欢

移动安全工具-jar

QT(35)-操作EXCEL-QXlsx-QAxObject

扎克伯格上手演示四款VR头显原型机,Meta透露元宇宙「家底」

2022年全国最新消防设施操作员(高级消防设施操作员)模拟题及答案
![[redis realizes seckill service ④] one order for one person, and cannot be purchased repeatedly](/img/75/bc588eb4e54899e93cc7df62e45820.png)
[redis realizes seckill service ④] one order for one person, and cannot be purchased repeatedly

I 刷题 I — 复制带随机指针的链表
![[microservices sentinel] cluster link | microservices cluster environment construction](/img/75/3cc6abf1e72d651b082415db9db46c.png)
[microservices sentinel] cluster link | microservices cluster environment construction

汇编语言(3)16位汇编基础框架与加减循环

2022 melting welding and thermal cutting recurrent training question bank simulated examination platform operation

2022 simulated 100 questions of safety officer-c certificate examination and online simulated examination
随机推荐
Default methods for Scala sample classes
Scala template method pattern
LLVM TargetPassConfig
中金财富证券开户佣金多少呢?股票开户交易安全靠谱吗?
使用 Loki 微服务模式部署生产集群
2022 crane driver (limited to bridge crane) examination question bank simulated examination platform operation
[practical series] full WiFi coverage at home
Can communication experiment between C and C
Scala trait construction mechanism
Go language operators (under Lesson 8)
Previous basic review (link)
Previous basic review
汇编语言(4)函数传参
图书馆管理系统代码源码(php+css+js+mysql) 完整的代码源码
Lenovo tongfuyao: 11 times the general trend, we attacked the city and pulled out the stronghold all the way
EVM Brief
Golang example renewal lock: redis+channel+sync Mutex
Deploy a production cluster using Loki microservice pattern
Scala trait inheritance class
[microservices sentinel] sentinel quick start | building an image | starting the console