Hey i keep getting the error 1222 "The used select statements have a different number of coloumns. I have found out the error is in this section

```
JOIN
 ( SELECT 3 snpos,x.name fa1,x.mass mz_fa1,x.catoms catomsfa1,x.dbnum dbnumfa1,y.name fa2,y.mass mz_fa2,y.catoms catomsfa2,y.dbnum dbnumfa2,z.name fa3,z.mass mz_fa3,z.catoms catomsfa3, z.dbnum dbnumfa3, x.mass+y.mass+z.mass total, x.catoms+y.catoms+z.catoms totcatoms, x.dbnum+y.dbnum+z.dbnum totdbnum FROM ms2frag x JOIN ms2frag y ON y.id <= x.id JOIN  ms2frag z ON z.id <= y.id
   UNION ALL
   SELECT 2      ,x.name fa1,x.mass mz_fa1,x.catoms catomsfa1,x.dbnum dbnumfa1,y.name fa2,y.mass mz_fa2,y.catoms catomsfa2,y.dbnum dbnumfa2, x.mass+y.mass total, x.catoms+y.catoms totcatoms, x.dbnum+y.dbnum totdbnum FROM ms2frag x JOIN ms2frag y ON y.id <= x.id
   UNION ALL
   SELECT 1,x.name fa1,x.mass mz_fa1, x.catoms catomsfa1, NULL,0,NULL,0, mass, catoms FROM ms2frag
 ) ms2frag

```

So just to explain in has to pick which of the following lines it should be according to if snpos =3 or 2 or 1.

The other parts of the code works, only this one which doesn't.