473,770 Members | 1,645 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help debugging this Query?

------=_NextPart_000_ 0175_01C35FE2.B C685E70
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit

Hi Guys,

I have 2 queries:

select * FROM kcs_threadgroup s 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_threadgroup s AS t1, kcs_threads AS t2 WHERE
t2.manufacturer ='DMC' AND t1.threadType=t 2.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=t 2.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.B C685E70--
Jul 19 '05 #1
0 1091

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

Similar topics

11
4010
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
1777
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 appreciated thanks you <?php session_start (); require_once "connect.php";
1
1193
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 error is nearly impossible. I realize that it's much cleaner when you have straight SQL, but otherwise the tool doesn't seem to be very user-friendly. Thanks, Mike
5
2800
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 ACC2K2 (SP-2) -------------- ---------------------------
5
2218
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 1,1,2,4. I have narrowed it down to the sort function. I'm almost positive
2
1805
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 QueryString? In other words when I start debugging can it start the page with a known query string specified without having to create a dummy page to do this?? Lloyd Sheen
2
1470
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 called so it looks like an image and not an animation. I have decided to put a wait function that will pause for 3 sec so that the animation will be loaded then the call the function for the long process. This is the <SCRIPT> section
9
2743
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 in. My business classes are, of course, decorated with the: <System.ComponentModel.DataObject() attribute. So, I drop a GridView on a webform and set its datasource to an ObjectDatasource which in turn is using one of my business logic...
11
319
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 in the WHERE clause as a date range (less than or equal to, and greater than or equal to the upper and lower dates of the range). I then need to count the total number of records returned from the query and output the record count to another...
7
2303
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 that info, but somewhere I've gone completely off the rails! Basically it is a room availability page for an intranet and should simply colour a calendar cell red if the room is booked, or green if it isn't. Rooms are typically booked by lecturers...
0
9595
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9432
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10232
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8891
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7420
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6682
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5454
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3974
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2822
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.