[AccessD] Select 2 fields from a subquery

Kaup, Chester Chester_Kaup at kindermorgan.com
Wed May 16 11:28:29 CDT 2007


I have the following query that selects on field (Price) from a table
(T_PriceIndex) with a sub query. I would like to select 2 fields from
the table (T_PriceIndex) used in the sub query. The current query looks
like this.

 

SELECT T_PriceCurrent.SDate, (Select Price from T_PriceIndex as T1 where
T1.Pattern = T_PriceCurrent.Pattern And T1.SDate=(Select Max(SDate) from
T_PriceIndex AS T2 where T2.Pattern = T_PriceCurrent.Pattern And
T2.SDate<=T_PriceCurrent.SDate)) AS PriceCurrent

FROM T_PriceCurrent;

 

I changed the query as below. It now generates an error and wants an
exists in the query. I am lost here. Can it be done? Thanks

 

SELECT T_PriceCurrent.SDate, (Select Price, Price2 from T_PriceIndex as
T1 where T1.Pattern = T_PriceCurrent.Pattern And T1.SDate=(Select
Max(SDate) from T_PriceIndex AS T2 where T2.Pattern =
T_PriceCurrent.Pattern And  T2.SDate<=T_PriceCurrent.SDate)) AS
PriceCurrent

FROM T_PriceCurrent;

 

Chester Kaup

Engineering Technician

Kinder Morgan CO2 Company, LLP

Office (432) 688-3797

FAX (432) 688-3799

 

 

No trees were killed in the sending of this message. However a large
number of electrons were terribly inconvenienced.

 




More information about the AccessD mailing list