473,386 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Query stuck

When I run my query it stuck is it possible that i can debug it

SELECT TOP 1 tblCredits.OPR, Min(tbl_CRCDollars.SumOfAMOUNT) AS
MinOfSumOfAMOUNT, Avg(tblCredits.Credit) AS AvgOfCredit,
Count(tblCredits.OPR) AS CountOfOPR1,
tbl_WorkingCountDays.CountOfREPORT_DATE,
([qry_TopDollarAvgDays]![CountOfOPR])/([qry_TopDollarAvgDays]![CountOfREPORT_DATE])
AS AvgNum INTO tbl_TopRep
FROM tbl_CRCDollars, qry_TopDollarAvgDays, tbl_WorkingCountDays,
tblCredits
WHERE (((tblCredits.ADJRSN) Not Like "4*"))
GROUP BY tblCredits.OPR, tbl_WorkingCountDays.CountOfREPORT_DATE,
([qry_TopDollarAvgDays]![CountOfOPR])/([qry_TopDollarAvgDays]![CountOfREPORT_DATE])
ORDER BY Min(tbl_CRCDollars.SumOfAMOUNT);

Thank You

Aug 16 '06 #1
1 2351
Colleen, your query has 4 tables, with no joins.

This gives you a Cartesian product, i.e. every possible combination. So,
even if there were only 100 records in each table, this query would generate
100 million records so it can select the top 1. Do you think this might be
why it gets "stuck"?

One of those source tables looks like it might be a query also, so there's
also more than that going on.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<co*********@gmail.comwrote in message
news:11**********************@m79g2000cwm.googlegr oups.com...
When I run my query it stuck is it possible that i can debug it
SELECT TOP 1 tblCredits.OPR,
Min(tbl_CRCDollars.SumOfAMOUNT) AS MinOfSumOfAMOUNT,
Avg(tblCredits.Credit) AS AvgOfCredit,
Count(tblCredits.OPR) AS CountOfOPR1,
tbl_WorkingCountDays.CountOfREPORT_DATE,
([qry_TopDollarAvgDays]![CountOfOPR])
/([qry_TopDollarAvgDays]![CountOfREPORT_DATE]) AS AvgNum
INTO tbl_TopRep
FROM tbl_CRCDollars, qry_TopDollarAvgDays, tbl_WorkingCountDays, tblCredits
WHERE (((tblCredits.ADJRSN) Not Like "4*"))
GROUP BY tblCredits.OPR,
tbl_WorkingCountDays.CountOfREPORT_DATE,
([qry_TopDollarAvgDays]![CountOfOPR])/([qry_TopDollarAvgDays]![CountOfREPORT_DATE])
ORDER BY Min(tbl_CRCDollars.SumOfAMOUNT);
Aug 16 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Bruno Alexandre | last post by:
Hi guys, withou using SP, I want to be able to add a Parameter to the SQL Query and retrive the Recordset so I can use the Paging property under the recorset object.... how can I do this? I'm...
1
by: Gary W | last post by:
Hello, I am stuck on what is probably a very easy select query. The query is: Select Count(*), Distinct PID, ID, Name From Table 1 Group By PID I get:
2
by: Mike B | last post by:
I apologize if this is off-topic. If it is off-topic, please direct me to a more appropriate group. I am writing an SQL query for a project and am a little stuck. I need to classify a list of...
3
by: Blue Bell Trading - Customer Services | last post by:
Hi, I need to export all data that was despatched on a specified date to an excel file. I tried creating a query but I am stuck? Thanks...
2
by: Mike Curry | last post by:
I have run into a problem, I have 2 fields in my database, both key fields: Table 1 ===== Field X <key> Field Y <key> In field X, there are say about 3 records for each unique Field Y. I...
7
by: KoliPoki | last post by:
Hello every body. I have a small issue. Problem: I have a table with 4 descriptor columns (type). I need to formulate a query to retrieve a count for each type so I can group by...etc. The...
4
by: KiwiGenie | last post by:
Hi..I’ve been teaching myself access through trial and error and google, but now I am completely confused and STUCK! These are the relevant forms in my database: frm_Recipes: Main form for...
3
by: deejayquai | last post by:
Hello Simple one this I guess, but I'm quite stuck at the moment. I would like to update the records displayed in my listbox (lstStudents) using criteria selected from my combo (cboForm) in a...
24
by: Dan2kx | last post by:
Hello to all that read and thank you to all that post Background: I have been tasked to create a holiday database for the employees in my lab, (so expect many more posts) im stuck at the first...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.