table 1 consists of three fields:
automaat-key (primary key)
automaat-status (0= active, 1 = inactive, 2 = blocked)
pin (filled with 0 or 1)
chip (filled with 0 or 1)
Table 2 consists of two fields:
For each automaat-status i got to have (separately) the sum of pin and the sum of chip. A row in table 1 is only taken in consideration when there is a row in table 2 for that specific automaat-key where tx-aantal > 0
Since there are three possible statuses, I will get three rows as a result.