Simple Query

  • Thread starter Thread starter cowichandave
  • Start date Start date
C

cowichandave

I am quering a database with 10000 records and the end result of the query
should be about 1500 records. It worked once and now it hangs for a bit and
returns 29 million records. What causes that?
 
I am quering a database with 10000 records and the end result of the query
should be about 1500 records. It worked once and now it hangs for a bit and
returns 29 million records. What causes that?

sounds like you have a join in there that's wrong or missing. Getting
ridiculous numbers of records (more than are in the table) is a clue
that you have a cartesian product. So check your joins.
 
Too many records could mean that you have multiple tables (or multiple
instances of the same table) with no link between them, so it selects a
record for each combination: that is, if one table has 100 records and
another has 500, but you have not linked at least one field, it will select
all 100 for each of the 500 (or all 500 or each of the 100), either way
resulting in 50000 records.

Try posting the SQL of your query, though, for better analysis.
 
Thank you. That is exactly what the problem was. I had 4 tables originally
and then modified the query using 3 of them and left the 4th unlinked. I was
not aware that the unlinked table would be used in the query.
 
Back
Top