Sample Header Ad - 728x90

I need the identical lines to merge

3 votes
1 answer
169 views
Previous question: https://dba.stackexchange.com/q/296218 I almost got this working. The problem that I have is that this variant of query does not merge the line from the SELECT with the one in the UNION if they are the same: SELECT CODPRO, VALPRO, COALESCE(SUM(UVCLIV), 0) AS SUM FROM FGE50LM0TV.GESUPD WHERE CNFLIG = '2' AND CODPRO IN (SELECT VALINV FROM FGE50LM0TV.SVINVD WHERE NUMINV = 59) GROUP BY CODACT, CODPRO, VALPRO UNION (SELECT VALINV, 0, 0 FROM FGE50LM0TV.SVINVD WHERE NUMINV = 59) ; This is what SVINVD looks like: enter image description here This is what GESUPD looks like: enter image description here No line for "PRODUIT5" here. So in consequence I get a doubled line: enter image description here
Asked by Oliviu Vais (33 rep)
Jul 28, 2021, 07:26 AM
Last activity: Feb 6, 2022, 07:36 PM