Query problem

Results 1 to 2 of 2

Thread: Query problem

  1. #1
    Join Date
    Dec 1969

    Default Query problem

    Hi all!<BR><BR>I have this query which displays records with the conditions as follows..<BR><BR>select distinct P.*,CT.CLIENT_TYPE,CD.CLIENT_DIV,B.BUSINESS,P.ECON OMIC_BUYER,P.FY,P.GPS_CONTACT_NAME,(CASE P.MOU_CONFIRMED WHEN 1 THEN &#039;Yes&#039; WHEN 2 THEN &#039;No&#039; WHEN 3 THEN &#039;Not Required&#039; END),P.MOU_CONFIRMED,CASE (SELECT COUNT(*) FROM Proj_DETAILS WHERE Project_Id = P.Project_Id) WHEN 1 THEN CM.Country_Name WHEN 0 THEN &#039;n/a&#039; ELSE &#039;GLOBAL&#039; END as Country FROM PROJECT_MASTER P,CLIENT_TYPE CT,CLIENT_DIV CD,BUSINESS B,Country_Master CM,PROJ_DETAILS PD WHERE PD.PROJECT_ID=P.PROJECT_ID AND P.CLIENT_TYPE_ID=CT.CLIENT_TYPE_ID AND P.CLIENT_DIV_ID=CD.CLIENT_DIV_ID AND B.BUSINESS_ID=P.BUSINESS_ID and P.MASK=0 and p.project_id=pd.project_id and PD.Country_Id = CM.Country_Id AND P.CREATED_BY=&#039;poopie&#039; and (pd.country_id=7 or P.REGION_ID=4) ORDER BY P.Project_ID <BR><BR><BR>if should display all the records for the following two conditions<BR><BR>(P.REGION_ID=4 AND P.CREATED_BY=&#039;POOPIE&#039;) or (pd.country_id=7)<BR><BR>if I try to put this condition its running that query forever..Pls help me out<BR><BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Query problem

    What database?<BR><BR>If sql server you should execute it in Query Analyzer and display the execution plan.<BR><BR>Have you set up your indexes correct?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts