473,399 Members | 3,832 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,399 software developers and data experts.

Help debugging this Query?

------=_NextPart_000_0175_01C35FE2.BC685E70
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit

Hi Guys,

I have 2 queries:

select * FROM kcs_threadgroups AS t1, kcs_threads AS t2 WHERE
t2.manufacturer='DMC' AND t1.thread_index=t2.id ORDER BY t2.type,
t1.groupName

Using the explain command (explain select.) I get:

+-------+--------+---------------+---------+---------+-----------------+
------+---------------------------------+
| table | type | possible_keys | key | key_len | ref |
rows | Extra |
+-------+--------+---------------+---------+---------+-----------------+
------+---------------------------------+
| t1 | ALL | NULL | NULL | NULL | NULL |
286 | Using temporary; Using filesort |
| t2 | eq_ref | PRIMARY | PRIMARY | 4 | t1.thread_index |
1 | where used |
+-------+--------+---------------+---------+---------+-----------------+
------+---------------------------------+

select * FROM kcs_threadgroups AS t1, kcs_threads AS t2 WHERE
t2.manufacturer='DMC' AND t1.threadType=t2.type ORDER BY t2.type,
t1.groupName

Using the explain command I get:

+-------+------+---------------+------+---------+------+------+---------
------------------------+
| table | type | possible_keys | key | key_len | ref | rows | Extra
|
+-------+------+---------------+------+---------+------+------+---------
------------------------+
| t1 | ALL | NULL | NULL | NULL | NULL | 286 | Using
temporary; Using filesort |
| t2 | ALL | NULL | NULL | NULL | NULL | 2067 | where
used |
+-------+------+---------------+------+---------+------+------+---------
------------------------+
With the second query, I am getting over 77,000 results returned and
with the first query I am getting 2067 - the correct amount.

The only differences between the 2 is that in the first I have WHERE
clause t1.thread_index=t2.id and in the second I have
t1.threadType=t2.type

I need to have the WHERE like the second query but for the life of my I
have no clue why it is returning over 77,000 results.

Can anyone help guide me to get the results of #1 but with the WHERE of
#2?

Thanks so much!

Aaron
------=_NextPart_000_0175_01C35FE2.BC685E70--
Jul 19 '05 #1
0 1070

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

Similar topics

11
by: James | last post by:
My form and results are on one page. If I use : if ($Company) { $query = "Select Company, Contact From tblworking Where ID = $Company Order By Company ASC"; }
5
by: josh dismukes | last post by:
/// Were having serious problems with this script it's basically the map script allowing player movement but the problem is in the QUERY and if statements on the cell type. Any help will be much...
1
by: Michael.EJ.Reynolds | last post by:
Is there any better way to debug a query encased in IIF statements than to find bugs at runtime? I have an especially ugly CommandText for one of my datasets, and debugging it when there is an...
5
by: MGFoster | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I've converted an ACC97 .mdb file to an ACC2K2 .adp. A report that worked in ACC97 doesn't work in ACC2K2. Report setup: ACC97 ...
5
by: ritchie | last post by:
Hi, I am writing to ask if anyone can see why my array is not being sorted correctly? It's an array of 4 elements(ints 1,2,3,4) but after calling the selection sort it comes back sorted as...
2
by: Lloyd Sheen | last post by:
I have a single page app that I want to test. It will be called from another app which will send the PK of a table to populate the form. Can I set up VS 2003 to start the page debugging with a...
2
by: Chris | last post by:
Hi, I have a Javascript function that loads a page with a progress bar for long process. The progress bar is a gif animation and for some reason it the animation is stuck when the function is...
9
by: SAL | last post by:
Hello, I have a Dataset that I have table adapters in I designed using the designer (DataLayer). I have a business logic layer that immulates the DataLayer which may/may not have additional logic...
11
by: troy_lee | last post by:
I have two fields on a form. These two fields' values are based on an expression and represent a date range. I need to create a SQL statement that will use the returned values of these two fields...
7
by: William (Tamarside) | last post by:
Please, if you have the time and knowledge to help me I'd truly appreciate it! I need to build a calendar page that displays available/unavailable info from a DB and colour a cell according to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.