简体   繁体   English

从连接查询中获取值

[英]Get values from join query

I have two tables: user and details table.我有两个表: user表和details表。 I want to display the details table in a table format.我想以表格格式显示详细信息表。

user table Structure is: user表结构为:

在此处输入图片说明

details Table Structure is: details表结构是:

在此处输入图片说明

Result table Structure is:结果表结构为:
在此处输入图片说明

I have tried this query:我试过这个查询:

SELECT A.*,B.name,C.name as Interviewer 
FROM exitdetail_hrms A
  LEFT JOIN hh_tbl_user B ON A.emp_id=B.sno 
  JOIN hh_tbl_user C
WHERE A.emp_id='12' AND C.sno='13' 

But I didn't get exact answer..kindly help me on this..但我没有得到确切的答案..请帮助我解决这个问题..

Thanking You..感谢您..

I am not sure, because you table description does not match the SQL you used, but i think the following SQL should solve your problem:我不确定,因为您的表描述与您使用的 SQL 不匹配,但我认为以下 SQL 应该可以解决您的问题:

SELECT A.*,B.name,C.name as Interviewer 
FROM exitdetail_hrms A
  LEFT JOIN hh_tbl_user B ON A.emp_id=B.s_no 
  LEFT JOIN hh_tbl_user C ON A.interviewed = C.s_no
WHERE A.emp_id='12' AND C.sno='13' 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM