??????????????????????????????????????
????????????????????????????tableFact????????????tableDimA??tableDimDetailB??tableDimDetailC????left
 
join??????????????????userId??actPkId??bId??cType??create_time??????????????????????????????????actPkId????????


??????????????????????????bId??cType??create_time????????????????????????????????????join??SQL????????????????????


????????????????


 tableFact(
 userId String primary key,
 create_time
 )
 
 tableDimA
 (
 actPkId String primary key,
 targetUserId String,
 start_time datetime,
 end_time datetime
 
 )
 
 tableDimDetailB
 (
 actPkId String primary key,
 bId String
 )
 
  tableDimDetailC
 (
 actPkId String primary key,
 cType String
 ) 


 ??????
A: fact.userlddimA.targetUserld
B: fact.bId == dimB.bId
C: fact.cType == dimA.cType
D: fact.create time &gt;= dimA.start time&nbsp; and fact.create time <= 
dimA.end time


??????????A??????????B??C??D????????????????B??C??D????????????????????????


??????????????????
?? (A B C)????A??B??C??????????????????????????&nbsp;
SELECT *&nbsp;
FROM tableFact P
LEFT JOIN tableDimA FOR SYSTEM_TIME AS OF P.proctime&nbsp; AS A ON P.userId = 
A.targetUserId
LEFT JOIN tableDimDetailB FOR SYSTEM_TIME AS OF P.proctime&nbsp; AS B ON 
A.actPkId = B.actPkId AND P.bId=B.bId
LEFT JOIN tableDimDetailC FOR SYSTEM_TIME AS OF P.proctime&nbsp; AS C ON 
A.actPkId = C.actPkId AND P.cType=B.cType;


?? (A B C D)????A??B??C D??????????????????????????????????????
SELECT *&nbsp;
FROM tableFact P
LEFT JOIN tableDimA FOR SYSTEM_TIME AS OF P.proctime&nbsp; AS A ON P.userId = 
A.targetUserId
LEFT JOIN tableDimDetailB FOR SYSTEM_TIME AS OF P.proctime&nbsp; AS B ON 
A.actPkId = B.actPkId AND P.bId=B.bId
LEFT JOIN tableDimDetailC FOR SYSTEM_TIME AS OF P.proctime&nbsp; AS C ON 
A.actPkId = C.actPkId AND P.cType=B.cType
&nbsp;WHERE P.create_time BETWEEN A.start_time AND A.end_time;
&nbsp;
????????????



&nbsp;


??????????????????Flink??????????????????????????????????????????????sql????????????????????????????????????????????????????




????
1227581...@qq.com



&nbsp;

回复