Skip to Content
0
Sep 10, 2018 at 06:36 AM

Help with query formation in Hana SP12

57 Views

I've a requirement where I want to show the count of customers shopping in two particular formats.

capture.png

For eg.:

According to this image :

The count of customers shopping in Format A alone is 10.

The count of customers shopping in Format A and B is 20.

The count of customers shopping in Format A and C is 30.

So on and so forth.

I've written the query which gives me output like :

(Select distinct 
a.Mobile,
a.Format_desc,
b.Format_desc
from
(Select distinct Mobile,Format_desc
from hadmin.Sum_rpo_item_sales a,
Hadmin.S_Site_master b 
where a.storE_no=b.store_no 
and format_Cd between 545 and 561)a,
(Select distinct Mobile,Format_desc
from hadmin.Sum_rpo_item_sales a,
Hadmin.S_Site_master b 
where a.storE_no=b.store_no 
and format_Cd between 545 and 561)b
where a.Mobile=b.Mobile);

capture.png

What can be the further step to achieve a result that I've attached in the first img ?

Attachments

capture.png (2.6 kB)
capture.png (19.1 kB)