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!

Select Number from a possible of 3 columns

Status
Not open for further replies.

fergy1

IS-IT--Management
Jul 25, 2003
32
0
0
US
Hello-

I have an owners table where they have a list of 3 different companies in 3 columns (cnumber, cnumber2, cnumber3). I want my query to search on all 3 columns to find the match for the company they logged in under. How can I do this? So example would be:

Code:
 Select * from owners where cnumber, cnumber2 or cnumber3 = companyID
 
Select * from owners where cnumber = companyID OR cnumber2 = companyID OR cnumber3 = companyID

-DNG
 
SQL allows for or statements like that on the where clause?
 
Yes...OR statements are allowed in the WHERE clause...

did you try it...are you getting in any errors...

-DNG
 
It worked. I'm just surprised. I have not seen an OR statement used like that before. Thanks!
 
it is how the OR statements are generally used...

anyways...glad its working for you...

-DNG
 
Yes, in asp or php not SQL at least that I have seen. If I had I would have used it...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top