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

SQL help

Status
Not open for further replies.

CC801340

IS-IT--Management
Jul 10, 2001
147
GB
I currently have a database table containing "jobs":

Tbl_Jobs(JobID, SpecNo, JobTitle, Description, Salary, JobType, JobType2, JobType3, JobType4, Location, Location2, Location3, Location4)

I have a page (searchjob.asp) where users can search for jobs using two combo boxes - they search by location and job type.

The page searchjobresult.asp page then gets the results of their search with the following code:

JS.Source = "SELECT SpecNo, Salary, JobType, Name, JobTitle, JobID FROM Tbl_Location a, Tbl_Jobs b WHERE JobType = " + Replace(JS__MMColParam, "'", "''") + " AND location = " + Replace(JS__MMColParam1, "'", "''") + " AND Location = LocationID ORDER BY SpecNo DESC"

(With the the two variables being....MMColParam = Request("jobtype") and MMColParam1 = Request("location")

As you can see, this only looks at values in the JobTpye and Location fields from the Tbl_Jobs table. I want the search to return results if the users choice is also in the fields JobType2, 3 or 4 or Location2, 3, or 4.

What would be the SQL statement to do this?

I hope this makes sense! Many thanks in advance!
 
mySQL = "SELECT * FROM Tbl_Location a, Tbl_Jobs b WHERE (JobType2, JobType3, JobType4, Location, Location2, Location3, Location4 Like '" & Search_String & "%')"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top