: Suppose i have table which has field like memberno(num),teaexp(num),lunchexp(num),dinerexp(num).I like to have sum of these expenses for date between 1 jan 2004 to 31 march 2004 for specific member.How to write query for this.
:
: Ganesh :)
:
Clearly, you cannot get the sum of the expenses for a specific date range when you don't have a field containing the date for the expense. If you do have a such fild, let's say it's named dateofexpense and the table's name is foodexp, the query would be:
SELECT memberno, Sum(teaexp) As Sumteaexp, Sum(lunchexp) As Sumlunchexp, Sum(dinerexp) As Sumdinerexp
FROM foodexp
WHERE dateofexpense >= '04-01-01' And dateofexpense <= '04-03-31'
GROUP BY memberno;
Hope this helps.
//gizzu