latitude800
IS-IT--Management
Good Morning
May I please have an assistance. I have worked on the query below but the query is creating very issues mainly in performance very costly. WOuld please take a look and see if would be a better way to write it. Thanks in advance.
The query is set up to limit access to certain ecommunities where course materials are distributed. The query determines if a user is:
a) a speaker at that particular course/conference
b) an attendee of that particular course/conference, during a specified time period
c) a board member, who have access to everything
Regards,
Jimmy
Select *
FROM Name
WHERE ID IN(SELECT n.ID FROM Name n INNER JOIN Orders o ON o.BT_ID=n.ID INNER JOIN Order_Lines ol ON ol.Order_Number=rder_Number INNER JOIN Product p ON p.Product_Code=ol.Product_Code INNER JOIN Meet_Master mm ON mm.Meeting=p.Product_Major WHERE (o.Status NOT LIKE 'C%' AND ol.Quantity_Ordered>0 AND ol.Product_Code IN ('NA06CEFEB/E07', 'NA06CEFEB/SPKE07', 'NA06CEFEB/CLE07')))OR ID IN (SELECT n.ID FROM Name n INNER JOIN Activity a ON a.ID=n.ID WHERE a.Activity_Type='COMMUNITY' AND a.Product_Code='290'AND(DateDiff(Day,GetDate(),'03/31/2006')>=0)) OR ID IN (SELECT n.ID FROM Activity a INNER JOIN Name n ON a.ID = n.ID WHERE a.PRODUCT_CODE = 'COMMITTEE/Board' AND n.status='A' AND a.THRU_DATE >= '03/31/2006')
May I please have an assistance. I have worked on the query below but the query is creating very issues mainly in performance very costly. WOuld please take a look and see if would be a better way to write it. Thanks in advance.
The query is set up to limit access to certain ecommunities where course materials are distributed. The query determines if a user is:
a) a speaker at that particular course/conference
b) an attendee of that particular course/conference, during a specified time period
c) a board member, who have access to everything
Regards,
Jimmy
Select *
FROM Name
WHERE ID IN(SELECT n.ID FROM Name n INNER JOIN Orders o ON o.BT_ID=n.ID INNER JOIN Order_Lines ol ON ol.Order_Number=rder_Number INNER JOIN Product p ON p.Product_Code=ol.Product_Code INNER JOIN Meet_Master mm ON mm.Meeting=p.Product_Major WHERE (o.Status NOT LIKE 'C%' AND ol.Quantity_Ordered>0 AND ol.Product_Code IN ('NA06CEFEB/E07', 'NA06CEFEB/SPKE07', 'NA06CEFEB/CLE07')))OR ID IN (SELECT n.ID FROM Name n INNER JOIN Activity a ON a.ID=n.ID WHERE a.Activity_Type='COMMUNITY' AND a.Product_Code='290'AND(DateDiff(Day,GetDate(),'03/31/2006')>=0)) OR ID IN (SELECT n.ID FROM Activity a INNER JOIN Name n ON a.ID = n.ID WHERE a.PRODUCT_CODE = 'COMMITTEE/Board' AND n.status='A' AND a.THRU_DATE >= '03/31/2006')