I have a table, mealdb, which has three fields viz. "userid", "timeofday", "daydate"(all varchar2). timeofday can have two values, “noon” or “afternoon”. Now I want to calculate the total number of afternoons against a given userid. I tried like
select sum(timeofday)
from mealdb
where timeofday='afternoon' where userid='1200';
But it is giving an error in Oracle 10g.
How do I fix this problem?
1 Answer