Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I have a table with
SALES:
salesid
pv000001
pv000002
pv900001
I Want to count only that begins with "pv00"
LOAD
COUNT(DISTINCT SALESID) AS CONTADOR_COMPRAS,
CUSTACCOUNT AS CUSTACCOUNT_CONTADOR,
if(COUNT(DISTINCT SALESID) >= 0 and COUNT(DISTINCT SALESID) <= 2, '1-2',
if(COUNT(DISTINCT SALESID) >= 3 and COUNT(DISTINCT SALESID) <= 4, '3-4',
if(COUNT(DISTINCT SALESID) >= 5 and COUNT(DISTINCT SALESID) <= 10, '5-10',
if(COUNT(DISTINCT SALESID) >= 11 and COUNT(DISTINCT SALESID) <= 20, '11-20',
if(COUNT(DISTINCT SALESID) >= 21 and COUNT(DISTINCT SALESID) <= 30, '21-30',
if(COUNT(DISTINCT SALESID) >= 31 and COUNT(DISTINCT SALESID) <= 40, '31-40',
if(COUNT(DISTINCT SALESID) >= 41 and COUNT(DISTINCT SALESID) <= 50, '41-50',
if(COUNT(DISTINCT SALESID) >= 51 and COUNT(DISTINCT SALESID) <= 60, '51-60',
if(COUNT(DISTINCT SALESID) >= 61, '60+'))))))))) as Classification
RESIDENT SALESTABLE
WHERE CREATEDDATETIME <='$(vminmonth)'
GROUP BY CUSTACCOUNT;
thanks!!!!
Eduard
i think you have to put another where condition for salesid i.e
if your above script is Working then you need only this
RESIDENT SALESTABLE
WHERE CREATEDDATETIME <='$(vminmonth)' and wildmatch(Salesid,'pv00*')
GROUP BY CUSTACCOUNT;
Load new table...resident firsttable;then do GROUP BY
is grouping now... I group by usserID i want to count the number os sales from a customer, but only the orders with PV00 not PV9
i think you have to put another where condition for salesid i.e
if your above script is Working then you need only this
RESIDENT SALESTABLE
WHERE CREATEDDATETIME <='$(vminmonth)' and wildmatch(Salesid,'pv00*')
GROUP BY CUSTACCOUNT;
tHANK YOUUUUUUU GREAT!!!