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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search 2 tblColumns with One Criteria

Status
Not open for further replies.

deadhead7

Programmer
Apr 18, 2003
57
US
Can you search 2 different columns in a table(columns are exactly the same)using only 1 criteria. For example 2 columns contain zipcodes, I want to enter on a form in a text box one zipcode and have it then search both columns to return those records.

Can this be done??
[morning]
 
This will show records from both columns:

select zipcode1,zipcode2 from <table> where zipcode1 = <zipcode variable> or zipcode2 = <zipcode variable>

This will show only records where the zipcode exists in both columns:

select zipcode1,zipcode2 from <table> where zipcode1 = <zipcode variable> and zipcode2 = <zipcode variable>


There's always a better way. The fun is trying to find it!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top