I have a column named purchasetype
which contains three kind of values new
,trial
,new,trial
another column in noofsales
I am counting the total number based on the purchasetype
The query I am using is
Select SUM(noofsales)
From table
GroupBy purchasetype
This query is giving me 3 kind of sum result new
,trial
and new,trial
I want total sum in new
and trial
only if one record contains new,trial
then one count should increase for new
and also one count should increase for trial
I have tried using substring_index function like
Select SUM(noofsales)
From table
Groupby substring_index(PurchaseType, ',', 0)
but this is summing up only for the first record in comma separated value.