当前位置:网站首页>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 .
边栏推荐
- LLVM TargetPassConfig
- Mobile security tool jarsigner
- Leetcode 1248. Statistics of "graceful subarray" (harm, suddenly found that it can only enumerate violently)
- LLVM TargetPassConfig
- Mobile security tool apktool
- 【实用系列】家内wifi全覆盖
- [redis realizes seckill business ③] specific implementation of optimistic lock for oversold problem
- ImageView展示网络图片
- Default methods for Scala sample classes
- Rich text tables, lists, pictures
猜你喜欢

4年工作經驗,多線程間的5種通信方式都說不出來,你敢信?

LLVM TargetPassConfig
![[redis realizes seckill business ③] specific implementation of optimistic lock for oversold problem](/img/01/5ec4e5dae1748dce3d5dee33a24b0b.png)
[redis realizes seckill business ③] specific implementation of optimistic lock for oversold problem

Thermodynamic diagram display correlation matrix

丹麥技術大學首創將量子計算應用於能源系統潮流建模

Bi-sql top

2022 simulated 100 questions of safety officer-c certificate examination and online simulated examination

Using macro code to generate handwriting automatically in word or WPS

Text editor for QT project practice -- Episode 9

2022 melting welding and thermal cutting recurrent training question bank simulated examination platform operation
随机推荐
Programmer: did you spend all your savings to buy a house in Shenzhen? Or return to Changsha to live a "surplus" life?
[redis realizes seckill service ②] solution to oversold problem
Text editor of QT project practice ---------- episode 11
Scala IO read by line
Yasea APK Download Image
4 years of working experience, and you can't tell the five communication modes between multithreads. Can you believe it?
Scala trait construction mechanism
Add information on the left and add parts on the right of the status bar
Novice, let me show you the "soft test" at one time
How much commission does CICC wealth securities open an account? Is stock account opening and trading safe and reliable?
2022 melting welding and thermal cutting recurrent training question bank simulated examination platform operation
卷积与转置卷积
Lenovo tongfuyao: 11 times the general trend, we attacked the city and pulled out the stronghold all the way
Heavyweight: the domestic ide was released, developed by Alibaba, and is completely open source! (high performance + high customization)
Mobile security tool jar
JS Chapter 1 Summary
【直播回顾】2022腾讯云未来社区城市运营方招募会暨SaaS 2.0新品发布会!
Input series
Which securities company should I choose to open an account online? Is it safe to open an account online?
Preliminary understanding of qtoolbutton