473,322 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Query that searches by employee or item title located in different tables

228 100+
Hi,

I have this database based on this logic: There are projects in a company. In each project, different employees different roles. One employee could have different roles in a single project. Also, can work in different projects at the same time. Some projects could be added but role of employees could be specified later on.

Employees: Empid,Empcode,Empname (autonumber,text, text)
Projects: Projectid,Projectcode,ProjectName (autonumber, text,text)
Roles: roleid,rolename (autonumber,text)

EmployeesProjects (autoid,empid,projectid,roleid)

The database works fine. So far, the company was searching by project code or name. But recently, they want to enter employee name in the same textbox and that would return projects he participated on. Also, the projectname will be searched along with it.

So, say if projectname is named David's Residence and there is an employee named David (who participated in the project or not), it returns the project and all other projects that an employee whose name includes David has participated in under any role.

How can I do that? The query please.
Dec 26 '10 #1
3 1345
Rabbit
12,516 Expert Mod 8TB
If you join EmployeeProjects to the other three tables, that will give you all the fields you're looking for.
Dec 26 '10 #2
samvb
228 100+
can u give me an example?
Dec 27 '10 #3
Rabbit
12,516 Expert Mod 8TB
Expand|Select|Wrap|Line Numbers
  1. Select fieldlist
  2. From table1
  3. Inner Join table2 on table1.FK = table2.PK
  4. Inner Join table3 on table1.FK = table3.PK
  5. Inner Join table4 on table1.FK = table4.PK
Dec 27 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: manning_news | last post by:
Using SQL2000. How do I format my select statement to choose one out of 24 different tables? Each table is slightly different and I was hoping I could use one select statement and format it...
10
by: Marizel | last post by:
I'm not sure there's an easy solution to this, but thought I'd ask. I often find myself with a query which I'd like to reuse, but with a different datasource. These datasources generally have...
4
by: New Guy | last post by:
I'm trying to work with a system that somebody else built and I am confounded by the following problem: There is a table of payments and a table of charges. Each client has charges and payments...
4
by: satish | last post by:
Values of two columns in two different tables--presentation using select Hi Everyone, i have two tables in the database . One is called address table and one is adressPhone Table. Below...
2
by: sangita | last post by:
i don't know how to write module or query for the following problem in access i have two tables in one access database where id no &record no is same in two different tables, also fields a1, a2,...
9
by: AimeeRae | last post by:
Ok. Another tricky Access question. Same database, different querry. I have a table called tbl_Responses and my tbl_Airing…similar to my question about linking Airings to Rates, I now need to...
0
by: Jerms | last post by:
Hello all, I've been using this site quite a bit since starting my project and have found it very helpful. I have run into a roadblock though that I cant seem to scrounge up a solution to. I...
3
by: nsymiakakis | last post by:
Hi everyone, I am hoping you can help me on this problem. I created 3 queries, each gives me a grand total Sum from various fields in 2 different tables. This part works great. Now I am trying to...
1
by: regikutty | last post by:
im a begginer,im using sql server 2005 i have 3 different tables Customer table intcid Companyname ProjectTable
1
by: plzansmyquery | last post by:
Hello, I am fresher to SQL Server. please help me with below query. does any one know how to get the total number of rows from two different tables in a single query. For ex: Table1 has 'x'...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.