Sent: Wednesday, September 05, 2001
5:15 PM
Subject: [DUG]: SQL Poser
Hi
This question relates to a Paradox database and a three
table query: the main table is Dockets the other two (Forest and Customer)
merely provide a look up to get Forest and Customer names.
Trouble is as follows:
I can select from Dockets and return the correct number of
dockets when I'm looking up either the Forest or the Customer but not
both. But this ONLY happens for one specific customer.
The tests I have done, with the results,
follow.
Can any one suggest what is happening here? I hope I
have given enough information.
ANY suggestions will be appreciated.
TIA
Mark
select D.DocketNo,
D.ForCode,
D.CustCode
from
Dockets D
where D.DocketDate >
'07/01/2001'
and D.CustCode = "HBERT"
and
D.ForCode = "MOCO"
Returns dockets
55895
55899
Now lookup Customer
name
select D.DocketNo,
D.CustCode,
C.CustName
from
Dockets D,
Customer C
where D.DocketDate
> '07/01/2001'
and D.CustCode = C.CustCode
and
D.CustCode = "HBERT"
Returns dockets
55895
55899
Now lookup Forest name
instead
select D.DocketNo,
D.ForCode,
F.ForName
from
Dockets D,
Forest F
where D.DocketDate >
'07/01/2001'
and D.ForCode = F.ForCode
and
D.ForCode = "MOCO"
Returns dockets
.
.
55895
55899
.
.
.
Now try to lookup both Customer AND Forest
names
select D.DocketNo,
D.ForCode,
F.ForName,
D.CustCode,
C.CustName
from
Dockets D,
Forest F,
Customer C
where
D.DocketDate > '07/01/2001'
and D.ForCode =
F.ForCode
and D.CustCode = C.CustCode
and
D.ForCode = "MOCO"
BOTH DOCKETS MISSING
select D.DocketNo,
D.ForCode,
F.ForName,
D.CustCode,
C.CustName
from
Dockets D,
Forest F,
Customer C
where
D.DocketDate > '07/01/2001'
and D.ForCode =
F.ForCode
and D.CustCode = C.CustCode
and
D.CustCode = "HBERT"
BOTH DOCKETS MISSING