sql server - how to outer join two tables? -


i have following tables: tbla (id, price), tblb (id, minpay) example:

tbla id        price 001       1.00 003       2.00  tblb id        minpay 001       10.00 004       20.00 

i need somehow join 2 tables following result:

id        price       minpay 001       1.00        10.00 003       2.00        0 004       0           20.00 

does know how achieve this?

use coalesce() replace null 0 value

select a.id, coalesce(a.price,0) price, coalesce(b.minpay,0) minipay tbla full outer join tblb b  on a.id=b.id  

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -