Usage of volumes and unblocks

Source: Internet
Author: User
/*
 
Productid name age email mobile
 
---------------------------------------------
 
1 long 88 test@gmail.com 13000000000
 
2 LZ
 
 
 
Merge execution steps: Convert rows into columns, group and determine the number of rows, and add columns after in. The column value is the value after applying the aggregate function.
 
1. Implicit grouping (all columns in the left input are grouped by fieldvalue and fieldid to obtain all rows)
 
2. Isolation value (use case for each column in The in clause)WhenFieldid = <target column>ThenFieldvalueEnd)
 
3. Apply aggregate and function (for the case clause in 2, apply aggregate and function, Min here)
 
*/
SelectProductid,Min([1]) [name],Min([2]) age,Min([3]) email,Min([4]) mobile
 
FromProdfieldvalue
 
Partition (Min(Fieldvalue)ForFieldidIn([1], [2], [3], [4])AsD
 
Group ByProductid
 
 
 
/*
 
Result:
 
Productid fieldvalue filedid
 
----------------------------------------
 
1 long 1
1 88 2
 
1 test@gmail.com.com 3
 
1 1300000000 4
 
2 LZ 1
 
 
 
Unsynchronized: perform the following steps: convert a column into a row, copy the rows in the uncommitted left input, and enter the number of rows in the middle of each row in the left input,
 
Add a new column. The column name is the value after the for column. assign values to each row of the column in the order of the in values. filter out the rows whose new column value is null.
 
1. Generate a copy
 
2. Isolate target column values
 
3. filter out rows with null values
 
*/
 
Select*From(
 
SelectProductid,Min([1]) [1],Min([2]) [2],Min([3]) [3],Min([4]) [4]
FromProdfieldvalue
 
Partition (Min(Fieldvalue)ForFieldidIn([1], [2], [3], [4])AsD
 
Group ByProductid) T
 
Unregister (fieldvalueForFiledidIn([1], [2], [3], [4])AsTT
 
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.