2013-08-24 42 views

回答

0
SELECT theDate, COUNT(theDate) AS NumOccurrences 

FROM someTable GROUP BY theDate 

HAVING (COUNT(theDate) > 1) 
+0

這應該是'sum()'不'count()' –

2

這裏是SQLFiddle

SELECT date, SUM(billamount) 
    FROM tab1 GROUP BY date; 
0

sqlfiddle

select d as "date", 
     sum(amount) as "bill amount", 
     count(*) as "count" 
from T 
group by d 
having count(*) > 0 --change zero to occurrence number you wish 
order by d; 

sqlfiddle

enter image description here

相關問題