Query with multilble expressions

  • Thread starter Thread starter Dan
  • Start date Start date
D

Dan

I supply a grocery chain with videos. Each movie studio uses several "root"
UPC's that identifies the studio as the supplier of the video. For instance,
Warner Brothers uses several UPC numbers that start with.
12569XXXXX
14764XXXXX
26359XXXXX
and about 15 more similar numbers. The 12569 identifies this as a Warner
title and there may be hundreds of combinations after that, one for each
specific video title.
My problem is, I want to create a query that will return the same result as
Like "12569*" but I want to list all 18 root UPC numbers in the query so
that it will return all Warner titles in one query. Is there a way I could
list the root numbers in a table and then create a query or must I list all
numbers in the criteria of a query?
Thanks for your help,
Dan
 
Assuming the roots always have 5 digit characters, try:

1. Create a tblRoot similar to:

Supplier Root
W 12569
W 13000
....

2. SQL String should be something like (****untested****):

SELECT TV.*
FROM tblVideo As TV
WHERE Left(TV.[UPC], 5) In
( SELECT TR.Root
FROM tblRoot As TR
WHERE TR.Supplier = "W"
)
 
Back
Top