I have a column (*Purchasetype*), userid in video table purchasetype is some how containg values 0,1, 2,3,4,.. etc. I want two sum these value order by userid.
For ex: sum ( purchasetype ) order by userid but I want like this
if purchasetype= 0 then its value is 0.99
if purchasetype =1 or 20 then its value is 3.99
if purchasetype = 3 or 13or 22 then its value is 9.99
so on. Below is complete list
0 ,17= 0.99
1,20=3.99
2=6.99
3,13,22=9.99
4,5,6,7,8,,10,11,12=0.00
14=19.99
15,23=39.99
16,24=59.99
18,21=01.99
19=02.99
else
19.99
i want to sum all the values of purchasetype with their replaced values (given above) order by userid
do we can put condition inside the sum() function of mysql; If its possible then please give me solution , may be this will solve my problem