if i have five tables, and i have to change values in first table whose columns are depended on these four tables. which query is batter and good? this one....?
select A.id as folder_id,
A.name as folder_name
from mst_folders A join mst_folder_requests B
on A.id = B.folder_id
where B.user_id = @employeeId
and B.wfitem_id in
(select item
from mst_wfitem_action_map
where item in
(Select ID
from mst_wfitems
where type = @WorkflowId and wfevent_id in
(select id
from mst_wfevents
where type_id = @EventTypeId
and user_id = @employeeId)
)
and actor = @actorId and state = 'P')
or this one?
select A.id folder_id,
A.name folder_name
from mst_folders A
join mst_folder_requests B on A.id=B.folder_id
join mst_wfitem_action_map C on B.wfitem_id = C.item
join mst_wfitems D on C.item=D.id join mst_wfevents E on D.wfevent_id=E.id
where B.user_id=@employeeId
and D.type=@WorkflowId
and E.type_id=@EventTypeId
and E.user_id=@employeeId
and C.actor=@actorId and C.state='P'