sql - Joining Tables: Only (!) add missing rows -


i want join following tables (records, tip). goal missing war rows (dependend on id) added. example see war = 2 missing id = 80.

note: war smaller or equal value of tip. value of value should null in added rows. table in bottom goal.

enter image description here

i not sure how solve problem. condition results of records."tip" >= tip."tip".

i use hana database.

thank in advance. best regards.

this how works (sorry these tips little bit confusing):

   select a."id", b."tip" "war", c."val" (         select distinct "id", max("tip") "max" records t         group "id"     )     inner join tip b on 1=1     left join t0 c on a."id" = c."id" , b."tip" = c."war"     b."tip" <= a."max"     order a."id", b."tip" 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -