-1

以下のクエリでは、異なるテーブルから 2 つの属性をリストする必要があります。上記のクエリを書く簡単な方法はありますか?

Tables:
Patient (PatientID, FamilyName, GivenName,Address) 
Item (ItemNo, Info, Fee)
Account (AccountNo, PatientID, Date)
AccountLine (AccountNo, ItemNo)

ジョン・ウェインという名前の患者のアイテム情報とすべての治療の日付をリストします。

Select FamilyName =” Wayne” and GivenName=”John” (Patient)> Temp1
        Temp1*Temp1.PatientID = Account.PatientID (Account) > Temp2

 - Updated

Temp2*Temp2.AccountNo = AccountLine.AccountNo (Temp2 X Account) >Temp3
Temp3*Temp3.ItemNo = Item.ItemNo (Temp3x Item) > Temp4
Select Description, Date(Temp4)

Join Answer 
Select Description, Date (Restrict FamilyName =” Wayne” and GivenName=”John” (Patient) Join Account Join Item Join AccountLine)
4

1 に答える 1

1

よく似ている[homework]のでヒントだけ載せておきます…

テーブルから選択するのではなく、具体的に結合から選択できます。テーブルとテーブル
の自然な結合では、たとえば、John Wayne に関連付けられているすべての AccountNo および Date 値を見つけることができます。 同様に、別の結合では、AccountNo が指定された Item Info が検索されます。 そして、結合は別のものと結合できるので(競合がないと仮定して)、ほとんど解決したようです...PatientAccount

于 2011-10-03T04:42:48.433 に答える