Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
johnan
Creator III
Creator III

SQL AS400

Hi the best. stucking on one SQL:

SELECT CLICFIL222.OBBIP10H.B1CUS, CLICFIL222.MSCML102.CNAME, Count(CLICFIL222.OBBIP10H.B1CPO) AS Antalfsss,Max(substr(digits(CLICFIL222.OBBIP10H.B1TTM), 1, 2) concat ':' concat substr(digits(CLICFIL222.OBBIP10H.B1TTM), 3, 2)) AS MaxTID FROM CLICFIL222.OBBIP10H RIGHT JOIN CLICFIL222.MSCML102 ON CLICFIL222.OBBIP10H.B1CUS=CLICFIL222.MSCML102.CUSNO where CLICFIL222.OBBIP10H.B1TDT = current_date and CLICFIL222.OBBIP10H.B1CUS < '1000' and CLICFIL222.OBBIP10H.B1OTP not in 'KRE' GROUP BY CLICFIL222.OBBIP10H.B1CUS, CLICFIL222.MSCML102.CNAME ORDER BY Max(CLICFIL222.OBBIP10H.B1TTM) DESC

This give me data from CLICFIL222.OBBIP10H, but i even want CLICFIL222.MSCML102.CNAME if  there is no post in table CLICFIL222.OBBIP10H

I have tryed all the Joins but still not hit. I think i'm missing somthing?

CUST 25 have no hit in CLICFIL222.OBBIP10H but remains in CLICFIL222.MSCML102 and i want to show i like table here:

255CUST 13710:45
245CUST 2710:45
244CUST 32110:45
243CUST 42610:45
232CUST 54710:45
225CUST 63210:45
224CUST 73910:45
253CUST 83510:43
251CUST 92310:43
249CUST 102710:42
248CUST 114910:42
246CUST 123010:42
242CUST 133910:42
241CUST 142810:41
240CUST 156010:41
237CUST 165010:41
235CUST 171510:41
233CUST 183810:41
230CUST 195010:40
229CUST 201810:40
227CUST 219910:40
256CUST 22710:16
257CUST 23110:14
247CUST 24310:13
233CUST 25000:00

 

1 Reply
johnan
Creator III
Creator III
Author

Let's get this easier.. 🙂

SELECT CNAME
FROM CLICFIL222.MSCML102
inner JOIN CLICFIL222.OBBIP10H ON B1CUS =CUSNO
where B1TDT = current_date order by CNAME

 

In table CLICFIL222.MSCML102 i have many post (CName), so i want to show all the post from that table even if it doesn't get hit from OBBIP10H, i just want the names if theres not hits from OBBIP10H