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

Inner join + subselect or where?

Status
Not open for further replies.

Smarty

Programmer
Apr 12, 2001
191
BE
I have a sql question. I want a query which uses 3 tables: CONTACTS, TASKS and TASKTYPES.

Each contact can have several tasks, so i think there needs to be an inner join between contacts and tasks on the field ID_Contact (that is not the problem).

There is in the table tasks a field (ID_TASKTYPE) which needs to be replaced by the [TASKTYPES].[TAKSTYPE] field of the tasktypes table whith the corresponding ID_TASKTYPE. How do i do this? Subselect or where clause?

the query should look like this:

CONTACT 1
=> Taks 1 for contact 1 with the ID_tasktype changed by the tasktype from the table TASKTYPES
=> Taks 2 for contact 1
...

CONTACT 2
...

Thanx in advance,

Maarten
 
It gets even more complicated... on the CONTACT table there is an ID_COMPANY and i have to look up the companyname in the table COMPANIES like i have to do with the tasktypes...

Hmmz... i guess this isn't so easy huh

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top