How to select just the row in the second table?

I think you need to use a case statement for the value. Below is just off the top of my head, so you may need to use full join if that doesn’t work.

select t1.date, case when t3.IDCLIENT is not NULL then t3.value else t2.value end as Value
from Table1 t1 inner join Table2 t2 on t1.IDCLIENT = t2.IDCLIENT inner join
Table3 t3 on t1.IDCLIENT = t3.IDCLIENT

Leave a Comment