Dear list,
My task management app gets a list of tasks, like so:
--
<CFQUERY name="get_tasks" datasource="taskomatic">
SELECT
tasks.task_id,
tasks.name AS taskname,
tasks.deadline,
tasks.project_id,
tasks.importance_id,
tasks.owner_id,
tasks.lead_time,
tasks.status_id,
projects.project_id,
projects.name AS projectname,
projects.colour,
projects.company_id,
people.person_id,
people.name AS ownername,
importance.importance_id,
importance.importance AS importancename,
FROM tasks
JOIN projects ON tasks.project_id = projects.project_id
JOIN people ON tasks.owner_id = people.person_id
JOIN importance ON tasks.importance_id =
importance.importance_id
WHERE
tasks.status_id = 1
<CFIF Session.company_id neq 0>
<!--- this is the bit i need help with --->
</CFIF>
ORDER BY #order#
</CFQUERY>
--
What I'd like to happen is that: if the session variable "company_id"
is not 0, it only gets TASKS that belong to the PROJECT that the PERSON
is cleared for.
My link table is called PEOPLE_PROJECT and it has two columns:
--
person_id | project_id
--
There is a tasks.project_id and of course a project.project_id (and a
people.person_id if that's relevant).
How do I do this? I can't seem to get my head around it.
Many thanks!
CK.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application
http://www.houseoffusion.com/banners/view.cfm?bannerid=48
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:201369
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54