Good time of day
I have a table with groups of experiments (and their results in the table EXPERIMENTS).
Experiments in groups can be both successful and unsuccessful (depending on the coefficients selected in the calculation), they are indicated in the RESULT field, positive and negative values, respectively. In EXPERIMENTS there is a field COEFFICIENT_ID, for binding specific coefficients to specific experiments.

There is a second table with coefficients (COEFFICIENTS) for each group, which were used in the calculation of each experiment.

Before conducting a specific group experience, I display all possible coefficients for this group. The DataSet is attached to the COEFFICIENTS table, which displays a set of coefficients for a specific group of experiments.

select * from COEFFICIENT where GROUP = %s order by DATE_USE desc 

There is such a request:

 select sum(case when a.SUM > 0 then 1 else 0 end) as POSITIVE, sum(case when a.SUM < 0 then 1 else 0 end) as NEGATIVE, c.ID, c.PRICE, c.STOP, c.TAKE, c.REMARK, c.IND_GROUP, c.DATE_USE from COEFFICIENT c inner join EXPERIMENTS e on c.ID = e.COEFFICIENT_ID where c.IND_GROUP = 1 group by c.ID, c.PRICE, c.STOP, c.TAKE, c.REMARK, c.IND_GROUP, c.DATE_USE order by c.DATE_USE desc 

Problem :
The fact is that in the COEFFICIENT table, there are such factors that are tied to individual groups, but which have not yet participated in the experiments. So they are not displayed in the DataSet, but they need to be displayed.

enter image description here

  • Thanks, helped - Konstantin78

1 answer 1

Use outer join :

inner join -> left join