Oracle的查詢語句Groupby的使用?
實際上題目考察的就是分組。通過group by進行分組后,可以通過sum進行求和,count進行數(shù)值計算。sql:select username ,count(accountNo) as count,sum(amount) as amount from tablename group by username;以上就可以求出username下,accountNo的條數(shù)和對應的總amount。
Oracle的查詢語句Groupby的使用?
實際上題目考察的就是分組。通過group by進行分組后,可以通過sum進行求和,count進行數(shù)值計算。sql:select username ,count(accountNo) as count,sum(amount) as amount from tablename group by username;以上就可以求出username下,accountNo的條數(shù)和對應的總amount。