You get the error because you did not select anthing from the table
containing the full name.  you only selected from tasks table.

try this:
SELECT t.*, c.*
FROM tasks t INNER JOIN contacts c
ON t.owner_id = c.contact_id

The ON statement joins the 2 tables by that item.  I was guessing, in the
query above, that owner_id and contact_id are the same number.
Alex



----- Original Message -----
From: "Colin Robinson" <[EMAIL PROTECTED]>
To: "SQL" <[EMAIL PROTECTED]>
Sent: Thursday, May 24, 2001 6:22 AM
Subject: JOIN with correlation names


> I have two tables
>
> [tasks]
> task_id
> task_summary
> task_owner_id (foreign key driver_id from [drivers])
> task_assignee_id (foreign key driver_id from [drivers])
>
> [contacts]
> contact_id
> contact_fullname
>
> I want to write a query that joins the two tables and allows me to display
> the full names of both owner and assignee for a task
>
> SELECT *
> FROM tasks
> JOIN priorities ON priority_id = tasks.task_priority
> JOIN contacts as owner ON owner.contact_id = tasks.task_owner_id
> JOIN contacts as assignee ON assignee.contact_id = tasks.task_assignee
>
> Why do I get an error when I try to output #owner.contact_fullname# ?
>
> Cheers Colin.
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to