我正在尝试内连接 table1 < - to - > table2, table3, table4 OR table5 ,具体取决于 table1 中的字段 . 因此,如果table1中的字段 information 具有值 example_get_from_two ,我应该内部连接 table1 with table2 以获取给定行,如果在另一行中table1具有值 example_get_from_three ,我应该内部连接 table1 with table3 ,依此类推 . 这是我试过的查询,但它返回零行:

SELECT n.notification_type, 
  (CASE WHEN n.notification_type = 'two' AND n.information = t2.somefield
            THEN t2.anotherfield
        WHEN n.notification_type = 'three' 
            THEN (CASE WHEN t3.field = '1' THEN t3.otherfield ELSE t3.yetanotherfield END)
        WHEN n.notification_type = 'four' AND t4.field = n.information 
            THEN t4.anotherfield
        WHEN n.notification_type = 'five' 
            THEN t5.field
   END) AS information FROM table0 zero, notifications n
        INNER JOIN table1 t1 ON(n.information=t1.somefield AND n.notification_type = 'something')
        INNER JOIN table2 t2 ON(n.information=t2.somefield AND n.notification_type = 'something')
        INNER JOIN table3 t3 ON((n.information=t3.somefield OR n.information=t3.someotherfield) AND n.notification_type = 'something') 
WHERE zero.field ='something' AND n.id = zero.id

不幸的是,这会检索零行而不应该这样,可能是因为尽管信息的实际值仍然是所有连接,并且 n.notification_type = "something" . 案件或类似情况可能吗?我想要获得的是

fromfield1 | fromfield2 | fromfield3(这个是“动态的”,取决于连接表)