Skip to content
Advertisement

join tables and search for data in two diff table in mysql

Table 1: full

Table 2: old_data

Table 3 : new_data

Now, With MySQL, I want to merge tables and find related details. Logic is : If not available in ‘new_data’ then only find it in ‘old_data’

Output :

Note : No of rows for Table 1 = No of rows for output table.

Advertisement

Answer

You could left join the two tables, and then use coalesce() to pick the relevant values:

This assumes that language, area and market are never null. If that’s not the cas, then you can change the coalesce() expressions to:

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement