Re: Searching Multiple Tables
- From: "Bob Barrows [MVP]" <reb01501@xxxxxxxxxxxxxxx>
- Date: Mon, 27 Nov 2006 11:19:43 -0500
JP SIngh wrote:
Hi All,
I am building a search page for our HR database.
What database? Type and version please.
I am struglling to
create a query which will be able to search multiple related tables.
The main database holds the contacts i.e
ContactId,
ContactName
Then I have two simple tables which hold the Skills and Roles we use
Skills Table
SkillId
SkillName
RolesTable
RoleId
RoleName
I then have two further tables to allow skills per user to be stored
in the table
UserSkills
ContactId
SkillId
and also have UserRoles where I store ContactId, RoleId
From my search page I want to search users who have preformed a
certain role in the past and/or have certain skill.
"and" and "or" are mutually exclusive when speaking from a perspective
of boolean logic. You need to better define your requirements. I suspect
you actually mean "or", but in your attempted statement below, you are
using "and" ....
What I am lookingAgain, I am not attempting this until you reveal the database type and
for here is someone to help me build the top string in my page so I
can do something like this
SQL = "Select ..... (this is the one I cannot work out"
SQL = SQL & " where roleid=" request.form("roles") and Skillid=" &
request.form("skillid")
If I create joines it gives me multiple records for the same contact.
version. If I give a T-SQL answer, it will not work well in Jet.
Also ...
Further points to consider:
Your use of dynamic sql is leaving you vulnerable to hackers using sql
injection:
http://mvp.unixwiz.net/techtips/sql-injection.html
http://www.sqlsecurity.com/DesktopDefault.aspx?tabid=23
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
.
- Follow-Ups:
- Re: Searching Multiple Tables
- From: JP SIngh
- Re: Searching Multiple Tables
- References:
- Searching Multiple Tables
- From: JP SIngh
- Searching Multiple Tables
- Prev by Date: Searching Multiple Tables
- Next by Date: Re: Searching Multiple Tables
- Previous by thread: Searching Multiple Tables
- Next by thread: Re: Searching Multiple Tables
- Index(es):
Relevant Pages
|