sql-server - 使用子查询时从另一个表中获取名称

sql-server - 使用子查询时从另一个表中获取名称,第1张

我有这样的查询:

select 
    F_ExhibitionCode,
    F_ExhibitorCode 
from 
    T_ExhibitorLocation 
where 
    F_ExhibitorCode in (
        select 
            F_Exhibitor_Code 
        from 
            T_Exhibitor 
        where 
            F_Exhibitor_Name  LIKE '%''%')

我还有两个表,一个是* T_Exhibition *,另一个是“T_Exhibitor,F_exhibiton名称来自T_ExhibitionF_ExhibitorCode来自T_Exhibitor
最终结果我需要这样: F_Exhibitonnaem,F_E​​xhibition代码,F_exibitorname,F参展商代码。

最佳答案:

1 个答案:

答案 0 :(得分:3)

假设我理解你的表结构,我会建议这些内容:

SELECT EL.F_ExhibitionCode, EL.F_ExhibitorCode, E.F_exhibiton_name
FROM T_ExhibitorLocation EL
INNER JOIN T_Exhibitor E ON(EL.F_ExhibitorCode = E.F_ExhibitorCode)
WHERE E.F_Exhibitor_Name LIKE '%''%'
本文经用户投稿或网站收集转载,如有侵权请联系本站。

发表评论

0条回复