mysql
SELECT
*
FROM
mr_user_info u,mr_visit_info f,
(
SELECT
CASE
WHEN v.RELATION_TYPE = 2 THEN
(
从 mr_visit_info io,mr_item_info_fb aa 选择 io.VISIT_ID,其中 io.RELATION_ID = aa.ITEM_ID 和 aa.ORG_ID = '001' 且 v.VISIT_ID = io.VISIT_ID
)
WHEN v.RELATION_TYPE = 1 THEN
(从 mr_beauty_org_info_fb bof、mr_visit_info vq 选择 vq.VISIT_ID,其中 vq.RELATION_ID = bof.org_id AND bof.org_id = '001')
当 v.RELATION_TYPE = 3 THEN
(从 mr_visit_info vq、mr_doc_info_fb 文档中选择 vq.VISIT_ID,其中 doc.org_id = '001' 且 doc.doc_id = vq.RELATION_ID)
结束视频,
案例
当 v.RELATION_TYPE = 1 时
(SELECT
fb.ORG_NAME
FROM
bione_org_info fb,mr_visit_info v,mr_beauty_org_info_fb bp
WHERE
v.RELATION_ID = bp.org_id 和 fb.org_no = bp.org_id 和 bp .ORG_ID = '001'
)
WHEN v.RELATION_TYPE = 2 THEN
(
SELECT
i.ITEM_NAME
FROM
mr_item_info_fb i,mr_visit_info v
WHERE
v.RELATION_ID = i.ITEM_ID 且 i.ORG_ID = '001'
)
当 v.RELATION_TYPE = 3 时
(
SELECT
b.TRUE_NAME
FROM
mr_doc_info_fb b,mr_visit_info v
WHERE
v.RELATION_ID = b.doc_id 和 b.ORG_ID = '001'
)
END VisitName
FROM
mr_visit_info v
) ff
哪里
ff.vid = f.visit_id
和 f.user_id = u.user_id
AND f.relation_id != '0'