Help with a query (I'm a newbie)

D

DevilDog1978

I have over 6000 individual part numbers in my inventory. The program that
was designed to track the inventory of my various labs inventory was not
restrictive. Many of the part numbers in the database do not match the
inventory. How can I create a query that will match the first five characters
of the inventory to the information in he database?
 
M

Michel Walsh

SELECT parts.*, inventory.*
FROM parts LEFT JOIN inventory
ON LEFT(parts.partNumber, 5) = LEFT(inventory.partNumber, 5)



assuming your tables are parts and inventory, the query compares the first
five characters of the parts.partnumber with any record in inventory,
checking for an inventory partNumber matching those 5 characters. If no
match is found, NULL will be supplied in the result, under inventory fields.
If more than one match is found, one record for each match occurs in the
result.



Vanderghast, Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top