我在数据库tbLicence和tbJurisdiction中有两个表 tbJurisdiction有两个领域
- Jurisdiction as PK
- JurisdictionX as Jurisdiction Name
tbLicence
有三个领域
- Licence as PK
- AgentId
- Jurisdiction
让我们说
tbJurisdiction
包含值
- 1 - Alabama
- 2 - Florida
- 3 - New York
- 4 - Mexico
- 5 - New Jersey
tbLicence
包含值
- 1 - 224 - Florida, New York
- 2 - 304 - New Jersey, Alabama
现在我想在AgentId的基础上获取Jurisdiction和JurisdictionX,让我们说224
我希望最终输出应该像
- 2 - Florida
- 3 - New York
我尝试了以下查询
SELECT L.Jurisdiction,
L.JurisdictionX
FROM tbJurisdiction L
Join tbLicence P on
Jurisdiction
Where P.AgentId =@AgentId;
它不起作用
请帮帮我!!!