Wednesday, February 23, 2011

Show Total in SQL

SELECT distinct(b.fieldname),CONVERT(varchar,SUM(a.fieldname),1) as total
 from tablename a, tablename b
 where  a.fieldname=b.fieldname
 group by b.tablename

No comments:

Post a Comment