I have to table first one
type | nbD |
---|---|
PC | 2 |
second one
type | nbF |
---|---|
PC | 3 |
TAB | 2 |
and I want to have something like that
type | nbD | nbF |
---|---|---|
PC | 2 | 3 |
TAB | null | 2 |
You can achieve using below query.
Moreover, before asking for help from community, do some research of your own. I believe if you would have searched "SQL joins with example" in google, you would have get this in first or second result. By that way you learn more, and if you get stuck in the process then you have always have the option to ask for help.
Select a.type, b.ndb, a.ndf
from tab2 a
left join tab1 b on a.type = b.type