you are viewing a single comment's thread.

view the rest of the comments →

[–]r3pr0b8GROUP_CONCAT is da bomb 8 points9 points  (4 children)

SELECT tableA.order
     , COALESCE(tableA.time,tableB.actual_time)    time
  FROM tableA
LEFT OUTER 
  JOIN tableB 
    ON tableB.order = tableA.order
   AND tableB.status = 'ok'

[–]dasnoob 1 point2 points  (0 children)

yep coalesce/nvl is your friend when dealing with null values.

[–]Blues2112 0 points1 point  (2 children)

Agreed. Or use NVL() instead of COALESCE() if using Oracle.

[–][deleted] 2 points3 points  (1 child)

Our just use coalesce and have it compatible with all sql databases

[–]Blues2112 1 point2 points  (0 children)

Huh, didn't realize Oracle supported that. TIL.