|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
table 1
abc 241060 3332.29 table 2 abc def 241060 OH_Adm_InsPremOth table 3 def OH_Adm_InsPremOth 3332.29 result of inner join table 1 abc = table 2 abc and inner join table 2 def = table 3 def 241060 3332.29 OH_Adm_InsPremOth 3332.29 The above is fine but if I have table 1 abc 241060 3332.29 241070 5000.00 table 2 abc def 241060 OH_Adm_InsPremOth 241070 OH_Adm_InsPremOth table 3 def OH_Adm_InsPremOth 8332.29 result of inner join table 1 abc = table 2 abc and inner join table 2 def = table 3 def 241060 3332.29 OH_Adm_InsPremOth 8332.29 241060 3332.29 OH_Adm_InsPremOth 8332.29 241070 5000 OH_Adm_InsPremOth 8332.29 241070 5000 OH_Adm_InsPremOth 8332.29 |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
What is the query that you wrote? Given the sample data and the joins there
should be no duplicate rows in the result set. Try this: SELECT A.abc, B.def FROM Table1 AS A JOIN Table2 AS B ON A.abc = B.abc JOIN Table3 AS C ON B.def = C.def; HTH, Plamen Ratchev http://www.SQLStudio.com |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
"Whiskey" <Whiskey@discussions.microsoft.com> wrote in message
news:667F45B4-4660-445B-A195-DA542251CD94@microsoft.com... > table 1 > abc > 241060 3332.29 > > table 2 > abc def > 241060 OH_Adm_InsPremOth > > table 3 > def > OH_Adm_InsPremOth 3332.29 > > result of inner join table 1 abc = table 2 abc > and > inner join table 2 def = table 3 def > > 241060 3332.29 OH_Adm_InsPremOth 3332.29 > > The above is fine but if I have > > table 1 > abc > 241060 3332.29 > 241070 5000.00 > > table 2 > abc def > 241060 OH_Adm_InsPremOth > 241070 OH_Adm_InsPremOth > > table 3 > def > OH_Adm_InsPremOth 8332.29 > > result of inner join table 1 abc = table 2 abc > and > inner join table 2 def = table 3 def > > 241060 3332.29 OH_Adm_InsPremOth 8332.29 > 241060 3332.29 OH_Adm_InsPremOth 8332.29 > 241070 5000 OH_Adm_InsPremOth 8332.29 > 241070 5000 OH_Adm_InsPremOth 8332.29 > > Hi Post usable DDL and sample data see http://www.aspfaq.com/etiquette.asp?id=5006 along with the whole statements you are trying to execute. John |
|
![]() |
| Outils de la discussion | |
|
|