0
我有以下查詢,我想用IF
條件像修改:MySQL的 - 連接表與IF條件
if(specimen.snop_axis = 'M', join morphology
on morphology.morphology_code = specimen.snop_code, join functions on functions.functions_code = specimen.snop_code)
select *
from specimen
join topography_index
on substring(specimen.topography_index, 2, 2) =
topography_index.topography_index_code
join morphology
on morphology.morphology_code = specimen.snop_code
join functions
on functions.functions_code = specimen.snop_code
left join specimen_image_lookup
on specimen_image_lookup.specimen_fk = specimen.specimen_pk
left join image
on image.image_pk = specimen_image_lookup.image_fk
where specimen.specimen_pk = '$specimen'
如何把這個查詢被修改,如果條件納入呢?也就是說,IF語句需要替換:
join morphology
on morphology.morphology_code = specimen.snop_code
join functions
on functions.functions_code = specimen.snop_code
+1,您可以通過一分鐘 – radar 2014-09-29 03:03:38
@Used_By_Already打我...美麗!非常感謝! – IlludiumPu36 2014-09-29 03:06:18
您需要添加JOIN後左手形態... – IlludiumPu36 2014-09-29 03:08:43