Re: Complex Subquery: ...FROM(TRANSFORM... systax - (fixed linebreaks)

From: Stephen Rasey (raseysm_at_wiserways.com)
Date: 08/25/04


Date: Wed, 25 Aug 2004 18:39:51 -0500

No, I'm not stuck. I'm done.

Option 2: create another table to hold the items that were in the IN clause
was the way to go.
It is table H82 in the following disguised query tree.

With 5 elements in the H82 table (returning 5 columns in the query as part
of the T4.* in T1J6), the query executes in 1 second, 1000 records returned,
which I think is splended. Add 0.25 seconds for a dao delete and write for
up to 12 elements in H82, and we have a very acceptable application
response.

T1J4qnuAggSort:
TRANSFORM First([YY] & " @ " & Format([CC],"#")) AS Score

SELECT T2.A2IDSet, T2.OO, T2.PP

FROM ((H80 AS H80 INNER JOIN PP ON H80.IDH=H71.IDH) INNER JOIN J1T2qmax AS
T2 ON H71.OO=T2.OO) INNER JOIN H82 ON H80.IDTraceH=H82.IDTraceH

GROUP BY T2.A2IDSet, T2.OO, T2.PP

ORDER BY T2.OO

PIVOT H80.IDTraceH;

T1J5qxt:
SELECT T2.A2IDSet, T2.OO, T2.PP, Avg(H71.YY) AS AvgOfYY, Avg(H71.CC) AS
AvgOfCC, Avg(H71.CCT) AS AvgOfCCT, Min(H71.CC) AS MinOfCC, Min(H71.CCT) AS
MinOfCCT

FROM H82 INNER JOIN ((H80 INNER JOIN H71 ON H80.IDH = H71.IDH) INNER JOIN T2
ON H71.OO = T2.OO) ON H82.IDTraceH = H80.IDTraceH

GROUP BY T2.A2IDSet, T2.OO, T2.PP

ORDER BY Avg(H71.YY), Avg(H71.CC);

T1J6qnuAggSortedCrossTab:
SELECT T5.OO, T5.PP, T5.AvgOfYY, T5.AvgOfCC, T5.AvgOfCumCapexTrace, T4.*

FROM J1T5qnuAggSort AS T5 INNER JOIN J1T4qxt AS T4 ON T5.OO = T4.OO

ORDER BY T5.AvgOfYY, T5.AvgOfCC;

Stephen Rasey
Houston
http://wiserways.com
http://excelsig.org

"John Spencer (MVP)" <spencer4@comcast.net> wrote in message
news:412D1A6E.3583868A@comcast.net...
> Yes, I can see that you would have to use an IN clause in the Crosstab
query and
> specify the column names and since you cannot do that according to you
earlier
> messages then I think you are stuck unless you use some VBA to get the
column
> names from the just the crosstab and then build your overall query with
vba.
>
> :-(



Relevant Pages

  • Re: Cycling numbers and too few variables error
    ... You have some VBA, ... > One query that could be the issue isbelow. ... was sorted on the ORDER BY clause before the grouping of the GROUP BY ... exist like this in any real database language. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Query using ADO returns no data
    ... "Carla Bradley" wrote in message ... >I know very little about Access, but got stuck trying to support it. ... > Query using ADO does not return data. ... > clause is removed it again performs as expected. ...
    (microsoft.public.access.modulesdaovba)
  • Re: filter show all
    ... Consequently, if you put *anything* in the Criteria row under your field, it excludes the Null values. ... It is possible to craft a WHERE clause to return True if there's no match. ... Just before the end of that article, there is an example of how to do it in the query instead of via VBA if you really want to. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Using 2 form fields as one criterium
    ... when you concatenate the form references in a query, ... this will give you a WHERE clause in the SQL statement that is essentially ... i can't think of any way to do this without using VBA to write the SQL ...
    (microsoft.public.access.queries)
  • list of numbers stored as text in a table cell as the criteria for a query?
    ... clause of a query. ... I think there should be a quick way of doing this without resorting to ... VBA, but I can't think what it is. ...
    (microsoft.public.access.queries)