-1

I've got two tables (see below), RM and RP. In the RP Table below, the Provider key can have many RegionIds (key) associated with it. Can I create a query that will allow me to return a Provider with all of their associated RegionIds (using the RP table) and also grab the RegionIds respective ClientNum from the RM Table?

RM Table                      RP Table
--------                      --------
RegionId   key                RegionId   key
..                            Provider   key
..
ClientNum
4

1 回答 1

0

尝试这个:

SELECT P.*, RM.RegionId, RM.ClientNum
FROM Provider P
INNER JOIN RP ON P.ID = RP.Provider
INNER JOIN RM ON RM.RegionId = RP.RegionId

您将获得每个 provider/clientNum 关联的一行

[编辑以反映评论]

于 2013-06-28T15:35:46.007 回答