This discussion is archived
5 Replies Latest reply: Feb 26, 2013 10:03 AM by Johnbr (Oracle10G) RSS

Incorrect syntax near ')' error

Johnbr (Oracle10G) Newbie
Currently Being Moderated
Hi,

I can run the sub querey in this fine, but when I apply Select * around it, I get the Incorrect syntax near ')' error.

What am I doing wrong?
SELECT * 
  
 FROM
 (       
        SELECT 
        /* CFEs Remaining in QUE by Department*/
          "TBL_APPROVAL"."Type",
         /* When statement to isolate approved value. Compare to report.*/
         Case
                WHEN "TBL_APPROVAL"."Approved" = 2
                THEN 'Approved'       
                WHEN "TBL_APPROVAL"."Approved" = -1
                THEN 'Disapproved'       
                Else 'Pending'      
         End as 'Approved',
        
          Cast("TBL_CATEGORIES"."Name" as varchar) as 'Name',
          Cast("tb_employees2"."FirstName" as varchar) as 'FirstName',
          Cast("tb_employees2"."LastName" as varchar) as 'LastName',
          Cast("tb_employees2"."DepartmentName" as varchar) as 'DepartmentName',
          "TBL_MAIN"."AuthoredDate",
          Cast ("TBL_MAIN"."PK_CFEID" as int) as 'PK CFEID',
          Convert(Varchar(max),"TBL_MAIN"."Title") as 'Title'
          
        FROM
          (("Insite_TeamShare"."dbo"."TBL_MAIN" "TBL_MAIN"
        LEFT OUTER JOIN
          "Insite_TeamShare"."dbo"."TBL_CATEGORIES" "TBL_CATEGORIES"
        ON
          "TBL_MAIN"."FK_CategoryID"="TBL_CATEGORIES"."PK_CategoryID")
        LEFT OUTER JOIN
          "Insite_EmployeeContact"."dbo"."tb_employees2" "tb_employees2"
        ON
          "TBL_MAIN"."AuthorID"="tb_employees2"."EmpNumber")
        LEFT OUTER JOIN
          "Insite_TeamShare"."dbo"."TBL_APPROVAL" "TBL_APPROVAL"
        ON
          "TBL_MAIN"."PK_CFEID"="TBL_APPROVAL"."FK_CFEID"
        WHERE
          "tb_employees2"."DepartmentName" = 'Information Technology'
        
 )
 
 

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points