Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join this live chat April 6, 10AM EST - QlikView to Qlik Sense REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
geogou1973
Creator
Creator

Problem with count expression in sap hana sql

Hello,

I have the following script that is running

select mkpf~budat
,mkpf~mblnr
,ekko~lifnr
from mkpf
inner join mseg on mkpf~mblnr=mseg~mblnr and mkpf~mjahr=mseg~mjahr
inner join ekko on mseg~ebeln=ekko~ebeln
where mkpf~vgart='WE'
and mseg~ebeln in
(select ebeln
from rseg
inner join rbkp on rseg~belnr=rbkp~belnr and rseg~gjahr=rbkp~gjahr
where rbkp~tcode<>'MR1M');

when i try to count distinct the mkpf~mblnr with the following script 

select count(distinct mkpf~mblnr),
ekko~lifnr,
mkpf~budat
from mkpf
inner join mseg on mkpf~mblnr=mseg~mblnr and mkpf~mjahr=mseg~mjahr
inner join ekko on mseg~ebeln=ekko~ebeln
where mkpf~vgart='WE'
and mseg~ebeln in
(select ebeln
from rseg
inner join rbkp on rseg~belnr=rbkp~belnr and rseg~gjahr=rbkp~gjahr
where rbkp~tcode<>'MR1M')
group by ekko~lifnr,
mkpf~budat;

i take the message that is in the attached file

How can i write the script in order to have the count of distinct mkpf~mblnr by ekko~lifnr and 
mkpf~budat;

Thank you in advance.

 

2 Replies
geogou1973
Creator
Creator
Author

If i remove the commas , 

select count(distinct mkpf~mblnr)
ekko~lifnr
mkpf~budat
from mkpf
inner join mseg on mkpf~mblnr=mseg~mblnr and mkpf~mjahr=mseg~mjahr
inner join ekko on mseg~ebeln=ekko~ebeln
where mkpf~vgart='WE'
and mseg~ebeln in
(select ebeln
from rseg
inner join rbkp on rseg~belnr=rbkp~belnr and rseg~gjahr=rbkp~gjahr
where rbkp~tcode<>'MR1M')
group by ekko~lifnr
mkpf~budat;

It is running and i take the message in the attached file

Brett_Bleess
Support (Former)
Support (Former)

I am a bit confused on your post, as this appears to be SAP HANA SQL, we are not experts on that for sure in this forum, so I would recommend you post this in the SAP forums if that is the case, otherwise need further clarification on things.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.