473,386 Members | 1,766 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.

Non matching records

I have two tables

ITEMS:
items,description,mfg

MANUFACTURER:
mfg,full_name

The items database has 230,000 records, the manufacturer, 493 records. I want
to see how many records in the items table don't have a matching record in the
manufacturer table.

If I
select count(*),manufacturer.full_name from items,manufacturer where
items.mfg=manufacturer.mfg group by mfg;

I end up with 493 lines showing total items per manufacturer. I know there are
items where the corresponding manufacturer table does not have a match. How do
I find which records in the items table don't match something in the
manufacturer table?

Jul 19 '05 #1
2 2391
rowan[canspam] wrote:
I have two tables

ITEMS:
items,description,mfg

MANUFACTURER:
mfg,full_name

The items database has 230,000 records, the manufacturer, 493 records.
I want to see how many records in the items table don't have a matching
record in the manufacturer table.

If I
select count(*),manufacturer.full_name from items,manufacturer where
items.mfg=manufacturer.mfg group by mfg;


This might be a little slow:

select count(*) from items
left join manufacturer on items.mfg=manufacturer.mfg
where manufacturer.mfg is null;

It works like this:
- Find a match for each row in table1
- If there is no match, mark table2 values with null
- Count only rows where table2 values are null ( the rows where we
didn't get a match)
Jul 19 '05 #2
rowan[canspam] wrote:
I have two tables

ITEMS:
items,description,mfg

MANUFACTURER:
mfg,full_name

The items database has 230,000 records, the manufacturer, 493 records.
I want to see how many records in the items table don't have a matching
record in the manufacturer table.

If I
select count(*),manufacturer.full_name from items,manufacturer where
items.mfg=manufacturer.mfg group by mfg;


This might be a little slow:

select count(*) from items
left join manufacturer on items.mfg=manufacturer.mfg
where manufacturer.mfg is null;

It works like this:
- Find a match for each row in table1
- If there is no match, mark table2 values with null
- Count only rows where table2 values are null ( the rows where we
didn't get a match)
Jul 19 '05 #3

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

Similar topics

1
by: rowan[canspam] | last post by:
I have two tables ITEMS: items,description,mfg MANUFACTURER: mfg,full_name The items database has 230,000 records, the manufacturer, 493 records. I want to see how many records in the...
2
by: laurenq uantrell | last post by:
I'm hoping someone can tell me how to construct a stored procedure that deletes all records in tblA not matching the PK in tblB This gives me the recordset of all records in tblA with no matching...
1
by: David C. Barber | last post by:
I'm trying to determine if any matching records exist on a LIKE query performing a partial match of last names to a remote back-end database in the most efficient manner possible. LAN Traffic...
3
by: klufkee | last post by:
Hi all, I have two tables that are related to each other. One has 30K records while the other has 500. I ran a 'Without Matching' query to find records in the larger table that didn't have a...
1
by: amywolfie | last post by:
I am trying to prevent employees from referencing their own loans. Here's the VBA Code: Dim strApplicant As String strApplicant = "dbo_snapshot_loan_app.applcnt_first_nm & "" &...
6
by: andyalean1 | last post by:
Hello, I am trying to match an Id number that is shared across 2 xml files.I seem to be do the right thing bu it won`t display a match.Can you please help me find my error. I have a problem matching...
4
by: sesling | last post by:
I have two tables that contain identical fields. (Account, Amount, Customer ID). I have a query that joins on those three fields. For the most part when matching records I get a one for one match....
0
by: grego9 | last post by:
I have a bit of visual basic code in an excel spreadsheet that I need some help with. I am attempting to search a file called TO Cancellations2.xls for counterparty names and for each counterparty...
9
by: warrior2009 | last post by:
I have 2 lists (unlinked and unrelated), where one can be called the parent and the other the child with one to many relationship between parent-child. The child table is really big, over a million...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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: 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
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,...

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.