CREATE TABLE WORK.TOTALS AS
SELECT SUBJECT, SUM(SCORE) AS TOT_SCORE
GROUP BY SUBJECT;
On how to deal with missing visits, it is really not a coding question, it is more a methdological protocol question. What is the protocol for dealing with missing scores/visits in your research? For example, some leave them out, some fill in with the average, some fill in with the extrapolated value. The point is, there is no real one way to deal with missing data, you have to have a protocol that is based on your research on what to do about them.