我有两个表1.Inventtable和2.Texttable
1。
,下一张表是
2。
我需要从第二个表中选择项目编号,其中ID!= 2和filename = etable在Inventtable.how中为此编写查询
答案 0 :(得分:2)
您的查询(对于SQL Server):
select *
from Inventtable i
inner join Texttable t on t.itemNumber=i.Refkey
where i.ID<>2 and i.filename='etable'
答案 1 :(得分:0)
select distinct itemNumber from Inventtable join Texttable on itemNumber=Refkey
where ID != 2 and filename='etable'