我透過諮詢才知道的sql語句寫法

freeze2001發表於2008-01-30

1.取使用者個數,並且條件是balance相加>1000的

select count(*),region from (select region, entityid,sum(balance) from am_score_balance where scorecycle='200801'
group by region,entityid
having
sum(balance)>1000)
group by region;

 

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/705546/viewspace-166459/,如需轉載,請註明出處,否則將追究法律責任。

相關文章