首頁  >  文章  >  資料庫  >  mysql-报Subquery returns more than 1 row求解决,紧急,紧急!!!

mysql-报Subquery returns more than 1 row求解决,紧急,紧急!!!

WBOY
WBOY原創
2016-06-06 09:35:322698瀏覽

mysql

SELECT
*
FROM
mr_user_info u,mr_visit_info f,
(
SELECT
CASE
WHEN v.RELATION_TYPE = 2 THEN
(
select io.VISIT_ID from mr_visit_info io,mr_item_info_fb aa where io.RELATION_ID = aa.ITEM_ID and aa.ORG_ID = '001' and v.VISIT_ID = io.VISIT_ID
)

WHEN v.RELATION_TYPE = 1 THEN
(select vq.VISIT_ID from mr_beauty_org_info_fb bof,mr_visit_info vq where vq.RELATION_ID = bof.org_id AND bof.org_id = '001')
when v.RELATION_TYPE = 3 THEN
(select vq.VISIT_ID from mr_visit_info vq,mr_doc_info_fb doc where doc.org_id = '001' and doc.doc_id = vq.RELATION_ID)
END vid,
CASE
WHEN v.RELATION_TYPE = 1 THEN
(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 and fb.org_no = bp.org_id and 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 and i.ORG_ID = '001'
)
WHEN v.RELATION_TYPE = 3 THEN
(
SELECT
b.TRUE_NAME
FROM
mr_doc_info_fb b,mr_visit_info v
WHERE
v.RELATION_ID = b.doc_id and b.ORG_ID = '001'
)
END visitName
FROM
mr_visit_info v
) ff
WHERE
ff.vid = f.visit_id
and f.user_id = u.user_id
AND f.relation_id != '0'

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn