SELECT PT.PRES_NAME,PT.YRS_SERV,AVG(EN.VOTES)
FROM PRESIDENT PT,ELECTION EN
WHERE PT.PRES_NAME=EN.CANDIDATE AND PT.STATE_BORN='Texas'
GROUP BY PT.STATE_BORN,PT.PRES_NAME,PT.YRS_SERV
SELECT AVG(EN.VOTES)
FROM PRESIDENT PT,ELECTION EN
WHERE PT.PRES_NAME=EN.CANDIDATE AND PT.STATE_BORN='Texas'
GROUP BY PT.STATE_BORN
也要参加分组SELECT PT.PRES_NAME,PT.YRS_SERV,AVG(EN.VOTES)
FROM PRESIDENT PT,ELECTION EN
WHERE PT.PRES_NAME=EN.CANDIDATE AND PT.STATE_BORN='Texas'
GROUP BY PT.STATE_BORN,PT.PRES_NAME,PT.YRS_SERV
如果不想让他们分组就这样
SELECT AVG(EN.VOTES)
FROM PRESIDENT PT,ELECTION EN
WHERE PT.PRES_NAME=EN.CANDIDATE AND PT.STATE_BORN='Texas'
GROUP BY PT.STATE_BORN
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)