justine1364
Technical User
I have a table with information on sales. I want to generate a table showing:
- total sales per customer
- sales per customer in the last 18 months
The following code (which doesn't sum up anything) works:
SELECT usdsales, iif(table1.orderdate>dateadd("d", -548, date()), usdsales) as sales18months
from table1
When I try to sum up, it stops working and shows "Data type mismatch in criteria expression" message.
SELECT customerno, sum(usdsales),
sum(iif(table1.orderdate>dateadd("d", -548, date()), usdsales)) as sales18months
from linestable
group by customerno
How can I fix it?
Thank you
- total sales per customer
- sales per customer in the last 18 months
The following code (which doesn't sum up anything) works:
SELECT usdsales, iif(table1.orderdate>dateadd("d", -548, date()), usdsales) as sales18months
from table1
When I try to sum up, it stops working and shows "Data type mismatch in criteria expression" message.
SELECT customerno, sum(usdsales),
sum(iif(table1.orderdate>dateadd("d", -548, date()), usdsales)) as sales18months
from linestable
group by customerno
How can I fix it?
Thank you