Simple Query based on another simple query not working

vwgolfman

Registered User.
Local time
Today, 03:46
Joined
May 26, 2008
Messages
35
Hi,
I wonder if some kind soul can help me please?

I have a query which is based on another query.
When the second query runs, it asks for parameters but these values should be returned by the first query.

Why could this be?

Queries (simplified)....

qryAveData:
SELECT Avg(tblData.Par) AS Par, Avg(tblData.GrayLastRnd) AS GrayLastRnd, Avg(tblData.GrayHcp) AS GrayHcp
FROM tblData;

qrySummary:
SELECT ([qryAveData]![GrayLastRnd]-[qryAveData]![GrayHcp])/[qryAveData]![Par] AS GrayPerc
FROM tblData;

Many thanks for any help :)
 
It's OK I've realised my mistake :D

My second query should of course, have referred to the first query.

i.e. "FROM qryAveData"

Cheers :)
 
qryAveData needs to be in your from statement in qry summary.
Join on whatever the common field between tblData and qryAveData is.

Off topic: Looking at your screen name - I'm a big fan of the R32 myself.:cool:
 
please help

hey guys i have a similar issue ... i need to select half the count of a table and then insert this number into another query. A query I am trying to run times when transporting data to SQL so i need to split it in half and run it in chunks. Joining won't work I dont think because I just have just one number returned from the first query.

first query:


SELECT count(*)/2+1 AS HALF_COUNT
FROM table

Half count = 400000 for example

second query:


SELECT TOP [qryEDWHALF]![HALF_COUNT] ........................
FROM TABLE




Thanks,
 
Last edited:
Can I just create a variable that will hold that value or something??
 
By "transporting data to SQL" do you mean you are exporting data to SQL Server?
 
yah that doesnt really matter though for my situation as I just need the second query to return only half the rows in the table .... if your curious though I use a DTS package to run the query and populate the data in SQL server.

can I select the top half of the table in one query or something??
 
basically my question is how do I select the top half of a table.
 
i just found select top 50 percent ... in another forum ill try that and see what happens
 
k yah that solved it ... select top 50 percent .... then you can use not in to unselect the one row that overlaps
 

Users who are viewing this thread

Back
Top Bottom