sql server - how to select all value from two table -


 tablea                   tableb idprice      price             id         tax          idprice ----------------------       ------------------------------------   4          100               1          20              4 ------------------------     ------------------ ------------------   5          150               2          10              6 ------------------------     ------------------ ------------------   6          270             ------------------------ result = price   id   tax ----   ---   ---- 100      1    20 150      2    10 270    null  null query select   price,id,tax  tableb inner join tablea on tablea.idprice= tableb.idprice result   price   id   tax ----   ---   ---- 100      1    20 150      2    10 

select      a.price price, b.id id, b.tax tax       tablea  left outer join      tableb b on a.idprice = b.idprice 

use left outer join can records tablea.


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -