Help with a query (I'm a newbie)

  • Thread starter Thread starter DevilDog1978
  • Start date Start date
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?
 
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
 
Back
Top