Home > database >  Want to along while didn't out, SQL statements and ideas
Want to along while didn't out, SQL statements and ideas

Time:04-06



Want to get as a result, my statement:

The select a.S aleId, CAST the convert (varchar (10), a. d. ate, 112) AS the DATE) 'document DATE, a.C odeId' channel number,
B.G oodsNo 'article number, Arthur c. olor' color number ', '0' 'grow',
C.s. 1 case when & lt;> 0 then 'S1'
The when c.s. 2 & lt;> 0 then 'S2'
The when c.s. 3 & lt;> 0 then 'S3'
The when c.s. 4 & lt;> 0 then 'S4'
The when c.s. 5 & lt;> 0 then 'S5'
The when c.s. 6 & lt;> 0 then 'S6'
The when c.s. 7 & lt;> 0 then 'S7'
The when c.s. 8 & lt;> 0 then 'S8'
The when c.s. 9 & lt;> 0 then 'integrated'
The when c.s. 10 & lt;> 0 then 'S10'
The when c.s. 11 & lt;> 0 then 'S11'
The when c.s. 12 & lt;> 0 then 'speed 12'
The when c.s. 13 & lt;> 0 then '/S13'
The when c.s. 14 & lt;> 0 then '/S14'
End
'size' b.Q uantity 'number', p. rice * b.Q uantity 'sales' from table aa
Right on the join table B B a.S aleID=b.S aleID
Right on the join table C C b.S aleIDNum c.s. aleIDNum=where a.C heckDate='2021-04-05' and the Posted=1 and Customer_ID='172101'

I use the statement above, the following results are obtained, it is not what I want,


How to write SQL statements to get the following results:

  • Related