how to add A column in A table (B) is based on A table in the areaId
Check parentId values in table B and then found his grandparents (need is the highest-level cycle to parentId==null or parentId==02)
CodePudding user response:
Table A query:The SELECT e.e mpName, b.O rderNum, Arthur c. ustName, b.O rderMoney from SaleOrderHedTB a
Left the join SaleOrderDetTB b on a.S aleOrderNo=b.S aleOrderNo
Left the join EmployeeTB e on a.S Mr. Eller=e.E mpID
Left the join CustomerMasterTB c on a.C ustId=Arthur c. ustId
Where 1=1
And a.O rderDate BETWEEN '2018-09-01' and '2018-09-04 s'
And a.A uditFlag=1
CodePudding user response:
The