join - SQL table joining different people -
i join 2 tables showing different information population in table zp there people not shown in wg. add these people zp final table, in columns there no information, have zeros.
select * mobility.mzmv2010.wegeinland wg join mobility.mzmv2010.zielpersonen zp using ("hhnr","zielpnr")
an example can seen in picture:
presumably, want left join
. . . person table first:
select coalesce(sum(zp."wp" * "w_rdist")/(62868 * avg(zp."wp")), 0) mobility.mzmv2010.zielpersonen zp left join mobility.mzmv2010.wegeinland wg using ("hhnr", "zielpnr") ;
note: should qualify w_rdist
column specify table coming from.
Comments
Post a Comment