Am 17.01.2012 11:20, schrieb Oliver Peters:
Am 17.01.2012 10:50, schrieb YAN HONG YE:
how to add average value replace the ? to the end of line of this
following database:

ID name sex match chinese english phy chem total
CY001 cred male 104 112 101 85 99 697
CY002 rose female 87 105 98 119 101 693
CY003 helen male 120 98 68 80 75 623
CY004 jack female 98 68 115 91 85 642
CY005 tonny male 96 88 111 87 68 624
cy00a aav mmm ? ? ? ? ? ?


SELECT ID,name,sex,match,chinese,english,phy,chem,total
FROM table
UNION ALL
SELECT
cy00a,aav,mmm,AVG(match),AVG(chinese),AVG(english),AVG(phy),AVG(chem),AVG(total)

FROM table
;

Oliver

Sorry I forgot the 's

SELECT ID,name,sex,match,chinese,english,phy,chem,total
FROM table
UNION ALL
SELECT 'cy00a','aav','mmm',AVG(match),AVG(chinese),AVG(english),AVG(phy),AVG(chem),AVG(total)
FROM table
;

Oliver
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to