View Single Post
 
Old January 23rd, 2006, 02:46 AM
jfergy jfergy is offline
Authorized User
 
Join Date: Jan 2006
Location: , , .
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default Select a value across 3 different columns

Hello-

I have an owners table where there are 3 columns cnumber, cnumber2, cnumber3. When an owner logs in they choose which company they want to edit and that gets sent to a session variable called companyiD. How can I tell all my queries to pull only data that matches that companyID? In other words an owner may have 3 companies he chooses a company that is cnumber2. Rather than creating a column and companyID variable i want to have the query look at all 3 columns for that companyId and pull the values. Below is what i think might work but any help would be appreciated.

Code:
"Select * from gen_liability_form where Year_Completed = '" & ThisYear & "' and Session("CompanyID")IN (Select * from owners where cnumber, cnumber2,or cnumber3 = companyID)"