Hello All,
Below is how my data looks like
With this Query
The output will be
and
Item 3 will not come since the value is 1200.
Now I need the Distinct Customers who were part of that Query where the distinct Customer Count is only 3 and not the Sum (5). Now how do we get that value with the given query with all conditions applied.
Remember the SUM(SALES) should be applied to Branch And Item and from that I need the distinct CustomerCount.
Any help is highly appreciated.
Sri
Below is how my data looks like
Code:
Branch Item Customer Sales
10 1 C1 300
10 1 C2 400
10 1 C3 200
10 2 C1 500
10 2 C3 300
10 3 C1 1200
With this Query
Code:
SELECT
BRANCH,
ITEM,
COUNT(DISTINCT Customer || '-' || Branch)
FROM
TABLE1
GROUP BY
BRANCH,
ITEM
HAVING
SUM(SALES) BETWEEN 1 AND 1000
Code:
Branch Item CustomerCount
10 1 3
10 2 2
Item 3 will not come since the value is 1200.
Now I need the Distinct Customers who were part of that Query where the distinct Customer Count is only 3 and not the Sum (5). Now how do we get that value with the given query with all conditions applied.
Remember the SUM(SALES) should be applied to Branch And Item and from that I need the distinct CustomerCount.
Any help is highly appreciated.
Sri