Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running a Query for Multiple Fields

Status
Not open for further replies.

alexk824

Technical User
Nov 11, 2010
2
0
0
The following is a query we have. Im wondering how I can run multiple fields at the same time. Right now I have to change ((Contact1.KEY2)="1")) over and over to run through all the regions, but I want to know if there is a way to run 1 through 30 or so all at the same time without doing "1" query... "2" query... etc... any help on this would be greatly appreciated. Thanks

SELECT Contact1.Company, Contact1.address1 AS street, Contact1.address2 AS pobox, Contact1.City, Contact1.state, Contact1.zip, Contact1.phone1 AS phone,Contact1.fax, Contact1.Key2 AS service_area, ContSupp.CONTSUPREF AS CalDueDate, ContSupp.Linkacct AS Manufacturer, ContSupp.Country AS Model, Contact1.contact, Contact1.title,Contact1.phone2 AS phone1, Contact1.phone3 AS fax1, Contact1.ext1 AS ext
FROM ContSupp INNER JOIN Contact1 ON ContSupp.ACCOUNTNO = Contact1.ACCOUNTNO
WHERE (((ContSupp.RECTYPE)="P") AND ((ContSupp.CONTSUPREF) Like "201001%") AND ((ContSupp.ZIP) Is Null) AND
((Contact1.KEY2)="1"))
 
tried replacing ((Contact1.KEY2)="1"))
with
(Contact1.Key2) IN ('1','2','3','4','5')

and getting errors
 
Contact1.Key2 will never be IN ('1','2','3','4','5'), hence,the reason I added the trim() function.

AND trim(Contact1.Key2) IN ('1','2','3','4','5')

DJ Hunt
Phone: (978)2-3333
WebSite:
- The Hacker's Guide to GoldMine Premium
- One-on-One GoldMine Technical Support ( Fee Based )
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top