Home > database >  SQL statements to heavy, bosses, please look at how make, still use the case inside the when functio
SQL statements to heavy, bosses, please look at how make, still use the case inside the when functio

Time:10-22

Two tables a SSXX surgery (information), a fyxx (information)

Select
Bah medical record number, zyid hospital id, zycs admission, SSF operation power fee,
Max (case when xh='0' then SSCZMC else null end) first hand,
Max (case when xh='1' then SSCZMC else null end) secondary,
Max (case when xh='2' then SSCZMC else null end)
the third surgeryThe from (
Select
A. as ah bah, a.z yid as zyid, a.z ycs as zycs, a.x h as xh, a.s SCZMC as SSCZMC, b.s sf as SSF
The from
HY_VW_BASY_SSXX a LEFT JOIN HY_VW_BASY_FYXX on a. b ah=b.b ah and a.z ycs=b.z ycs
Where a.x h (0) and b.s in sf, & gt; 0 and a.r yrq & gt;=to_date (20191205, 'yyyy - mm - dd)
TMP)
Group by bah, zyid zycs, SSF




Want to ask how do you write this to heavy statement

CodePudding user response:

After this statement group by and repeat? What is the post