I have two questions:
I got my 1st answer here on how to group and sum the column, but I need to filter out by min amount of 100 ..
I tried
SELECT
member_code, SUM(product_price) as totalSales
FROM
src_calculation_daily
WHERE
totalSales > 100
GROUP BY
member_code
Any help is much appreciated. Thank you
I think you just want a HAVING
clause:
SELECT member_code, sum(product_price) as totalSales
FROM src_calculation_daily
GROUP BY member_code
HAVING totalSales > 100;
You are looking for HAVING
SELECT member_code, sum(product_price) as totalSales FROM src_calculation_daily GROUP BY member_code HAVING totalSales > 100
WHERE is used when the fields exists in your table
HAVING is used on a calculated value
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.