st_fip fip_code sic var_code bls1975
39 39003 79 1 0
39 39003 79 2 0
39 39003 79 1 -1
39 39003 79 2 -1
39 39003 79 1 327
39 39003 79 2 1421815
I want to group the above data by sic and fip_code and var_code and then sum column bls1975, however if any of the rows in bls1975 = -1 then want the answer to be -1 and not the sum of the column. So for the above example
bls1975 for var_code =2 would be -1 and for var_code=1 would be -1 ----- not the actual sum of the fields 326 and 1421814.
How would I do this in access or in PHP?