mysql 一张表的多个字段关联另外一张表

SELECT
vtiger_orderitem.orderid,
(
SELECT
vtiger_users.last_name
FROM
vtiger_users
WHERE
vtiger_orderitem.signatory = vtiger_users.id
) AS signatory,
(
SELECT
vtiger_users.last_name
FROM
vtiger_users
WHERE
vtiger_orderitem.servicer = vtiger_users.id
) AS servicer
FROM
vtiger_orderitem
SELECT
n.orderid,
m.last_name,
q.last_name
FROM
vtiger_orderitem n
LEFT JOIN vtiger_users m ON n.signatory = m.id
LEFT JOIN vtiger_users q ON n.servicer = q.id
上一篇:var_dump打印出来格式太乱 怎么调


下一篇:nmap扫描测试