返回首页


1。实体
EntityId名称
1 Rajni
2 neha
2。牌照

LicenseId EntityId LicenseType
1。 1我
2。 2楼

3。 EntityAddress

AddressId实体的AddressType市国
1起落架GGN哈里亚纳邦
2 1巴士,HHN最多
3 2起落架的XY KL
4 2路公交车生长激素HJ

现在,我要提取城市基础EntityId,列印LicenseType
n个状态如果LicenseType"我",然后的AddressType"主起落架"城市n个状态来
如果LicenseType的"F",THEN的AddressType"巴士"的城市n个状态来

回答

评论会员:游客 时间:2012/02/06
SwingSwis:请尝试此查询。据我理解你的问题,这是查询什么你问。对不起,如果misunderstood.if请给我一些更清晰。codeprespanclass="code-keyword"SELECT/spanEA.City,EA.State,EA.AddressTypespanclass="code-keyword"FROM/spanEntityAddressEAspanclass="code-keyword"INNER/spanspanclass="code-keyword"JOIN/spanLicenseLspanclass="code-keyword"ON/spanEA.EntityId=L.EntityIdspanclass="code-keyword"WHERE/spanL.LicenseType=spanclass="code-string""/spanspanclass="code-string"GivenLicenseType"/span/pre/code
sachin10d:试试这个

select L.LicenseType, EA.Address,EA.city,EA.sate from Entity E 

left outer join License L on E.EntityId = L.EntityId

left outer join EntityAddress EA on EA.Entity = L.EntityId

where E.EntityId = <entityid> and L.LicenseType = '<licensetype>'</licensetype></entityid>
评论会员:游客 时间:2012/02/06
FastEvo8:从实体é|选择L.LicenseType,EA.Address,EA.city,EA.sate左外联接许可LNBSP上E.EntityId外部联接EntityAddressEANBSPL.EntityId离开;上EA.Entity=L.EntityId(L.licenseType='我'与EA.AddressType='起落架')(L.licenseType="F"和​​EA.AddressType='巴士')