sql查询的字段可以直接关联表进行查询

— 查询平仓的合同关联用户的邮箱手机号和代理商及做市商
select u.user_id,u.email,u.mobile_number,(select g.name from organization g where g.id=u.agent_id) as daili,(select g.name from organization g where g.id=u.org_id) as zuoshi,o.* from core_order o,core_user u
where o.order_status=3
and o.user_id=u.user_id
order by o.user_id

sql查询的字段可以直接关联表进行查询_第1张图片

你可能感兴趣的:(学习笔记)