Link to home
Start Free TrialLog in
Avatar of sammySeltzer
sammySeltzerFlag for United States of America

asked on

Incorrect Syntax error - Please heeelp!

Dear experts,

I am using SQL  Server 2005 to code the following query but I just kept getting the following error:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near 'a'.

What am I doing wrong?

Any help is greatly appreciated.
SELECT 
  (SELECT COUNT(*)FROM tblMaster a,tblCODE cWHERE a.chsid=c.chsid and (c.Close_EmployedWhenReleased)='Y' and c. Start_Date > NULL and c. Start_Date < NULL and c. Close_Date > NULL and c.Close_Date < NULL ) AS A, 
 
(SELECT COUNT(*) FROM tblMaster a, tblCODE c WHERE a.chsid=c.chsid and UPPER(c.Close_RecvdJobTraining)='Y' and c.Start_Date > NULL and c. Start_Date < NULL and c.Close_Date > NULL and c. Close_Date < NULL ) AS B,
 
 (SELECT COUNT(*) FROM tblMaster a, tblCODE c WHERE a.chsid=c.chsid and UPPER(c.Close_OffPublicAssistance)='YES' and c. Start_Date > NULL and c.Setup_ Start_Date < NULL and c. Close_Date > NULL and c. Close_Date < NULL ) AS C
FROM xsystbl_SYSPARMS

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of BrandonGalderisi
BrandonGalderisi
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of chapmandew
SELECT
  (SELECT COUNT(*)FROM tblMaster a,tblCODE c WHERE a.chsid=c.chsid and (c.Close_EmployedWhenReleased)='Y' and c. Start_Date > NULL and c. Start_Date < NULL and c. Close_Date > NULL and c.Close_Date < NULL ) AS A,
 
(SELECT COUNT(*) FROM tblMaster a, tblCODE c WHERE a.chsid=c.chsid and UPPER(c.Close_RecvdJobTraining)='Y' and c.Start_Date > NULL and c. Start_Date < NULL and c.Close_Date > NULL and c. Close_Date < NULL ) AS B,
 
 (SELECT COUNT(*) FROM tblMaster a, tblCODE c WHERE a.chsid=c.chsid and UPPER(c.Close_OffPublicAssistance)='YES' and c. Start_Date > NULL and c.Setup_Start_Date < NULL and c. Close_Date > NULL and c. Close_Date < NULL ) AS C
FROM xsystbl_SYSPARMS
Avatar of sammySeltzer

ASKER

chapmandew:

It worked great but what did I do wrong?

I don't see it please forgive my slow uptake.

Thanks very much.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks very much
welcome
I thought I closed this thread.

Sorry guys.

Again, thanks a lot BrandonGalderisi: and chapmandew:

Any of your solutions would have worked for me.