If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Simple Query
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? -- CowichanDave |
#2
|
|||
|
|||
Simple Query
On Dec 8, 11:23*pm, cowichandave
wrote: 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? -- CowichanDave 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. |
#3
|
|||
|
|||
Simple Query
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. "cowichandave" wrote: 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? -- CowichanDave |
#4
|
|||
|
|||
Simple Query
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. -- CowichanDave "Brian" wrote: 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. "cowichandave" wrote: 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? -- CowichanDave |
Thread Tools | |
Display Modes | |
|
|