[AccessD] Subquery returns to many or no records

Gustav Brock gustav at cactus.dk
Sat Oct 11 05:45:47 CDT 2003


Hi Chester

> Tried your suggestion with no change in the result. I checked and there
> are 21 records on the subject date. I want to sum the records that meet
> the subquery criteria. Thanks

I think you need to elaborate a little (well, much) on this to get any
useful answers.
Not quite sure what you're after and why and which criteria for what
and if these are generic or for the sum only ...

/gustav


>> SELECT DISTINCT T9DATA_CATDAILYPRODM.ORAACTDT,
>> T9DATA_CATDAILYPRODM.BOPD FROM T9DATA_CATDAILYPRODM WHERE 
>> (((T9DATA_CATDAILYPRODM.ORAACTDT)=#10/1/2003#) AND 
>> ((T9DATA_CATDAILYPRODM.BOPD)=(SELECT BOPD from T9DATA_CATDAILYPRODM 
>> where USRFLD1 ="Y")) AND ((T9DATA_CATDAILYPRODM.AREADESC)="TEXAS GAS")
>> AND ((T9DATA_CATDAILYPRODM.SUPVNM)="TGF FORT STOCKTON" Or
>> (T9DATA_CATDAILYPRODM.SUPVNM)="TGF KERMIT"));

>> If I change the query to the following no records are returned

>> SELECT DISTINCT T9DATA_CATDAILYPRODM.ORAACTDT, 
>> T9DATA_CATDAILYPRODM.BOPD FROM T9DATA_CATDAILYPRODM WHERE 
>> (((T9DATA_CATDAILYPRODM.ORAACTDT)=#10/1/2003#) AND 
>> ((T9DATA_CATDAILYPRODM.BOPD)=(SELECT SUM(BOPD) from 
>> T9DATA_CATDAILYPRODM where USRFLD1 ="Y")) AND 
>> ((T9DATA_CATDAILYPRODM.AREADESC)="TEXAS GAS") AND 
>> ((T9DATA_CATDAILYPRODM.SUPVNM)="TGF FORT STOCKTON" Or 
>> (T9DATA_CATDAILYPRODM.SUPVNM)="TGF KERMIT"));



More information about the AccessD mailing list