Subject | AW: [firebird-support] join question |
---|---|
Author | Check_Mail |
Post date | 2017-04-11T13:53:53Z |
Helle SET,
perfect, many thannks 😊
Von: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com]
Gesendet: Dienstag, 11. April 2017 13:24
An: firebird-support@yahoogroups.com
Betreff: Re: [firebird-support] join question
Sorry, answered slightly to quickly:
Select a.nrworker, b.valueworkermonth
from table A
left join table B on a.nrworker = b.nrworker and b.year = 2017 and b.month = 4
where a.active = 1
2017-04-11 13:23 GMT+02:00 Svein Erling Tysvær <setysvar@...>:
Simple, just make sure you only refer to table b in the left join and not in the where clause:
Select a.nrworker, b.valueworkermonth from table A left join table B on a.nrworker = b.nrworker and a.active = 1 and b.year = 2017 and b.month = 4
HTH,
Set
2017-04-11 12:14 GMT+02:00 'Check_Mail' check_mail@... [firebird-support] <firebird-support@yahoogroups.com>:
Hello @ll,
I have a small question.
Table A
NrWorker ineger
Name
Active 0 or 1
…
Table B
NrWorker integer
Year
Month
ValueWorkerMonth
Now I would like to get all NrWorker from Table A with Active 1 and the ValueWorkerMonth from the Table B (from the current month)
This is like
Select a.nrworker, b.valueworkermonth from table A left join table B on a.nrworker = b.nrworker where a.active = 1 and b.year = 2017 and b.month = 4
Fine, but I would like also all Worker (NrWorker from Table A) where are not present in Table B in this month.
Table A
NrWorker 12
NrWorker 13
NrWorker 14
Table B
NrWorker 12
Year 2017
Month 4
I would like to get not only Worker 12, rather 13 and 14 too.
How can I realize it in Firebird?
Thank you