Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 syntax error

Author  Topic 

satya068
Posting Yak Master

233 Posts

Posted - 2011-11-18 : 05:46:30
i am getting syntax error in 'from' clause joins,showing syntax error for the below highlighted inner join.i have checked all the joins but not able find where i done wrong.i got struckup at this point,wondering if you could let me know where i have gone wrong, it would be much appreciate.


Selec * from
xxxxxxx
xxxxxx
xxxxx

FROM ((((HEALTH_ORGANISATIONS
INNER JOIN ((((((((((SCHEDULES AS SCP
INNER JOIN REFERENCE_VALUES AS VISIT ON SCP.VISIT_REFNO = VISIT.RFVAL_REFNO)
INNER JOIN REFERENCE_VALUES AS ATTND ON SCP.ATTND_REFNO = ATTND.RFVAL_REFNO)
INNER JOIN REFERENCE_VALUES AS CONTY ON SCP.CONTY_REFNO = CONTY.RFVAL_REFNO)
INNER JOIN REFERRALS ON SCP.REFRL_REFNO = REFERRALS.REFRL_REFNO)
INNER JOIN REFERENCE_VALUES AS REASON ON REFERRALS.REASN_REFNO = REASON.RFVAL_REFNO)
INNER JOIN PATIENTS ON SCP.PATNT_REFNO = PATIENTS.PATNT_REFNO)
LEFT JOIN SPECIALTIES AS SPECIALTIES_1 ON REFERRALS.REFTO_SPECT_REFNO = SPECIALTIES_1.SPECT_REFNO)
LEFT JOIN STAFF_TEAMS ON REFERRALS.REFTO_STEAM_REFNO = STAFF_TEAMS.STEAM_REFNO)
INNER JOIN REFERENCE_VALUES AS SORRF ON REFERRALS.SORRF_REFNO = SORRF.RFVAL_REFNO)
LEFT JOIN PROF_CARERS ON REFERRALS.REFTO_PROCA_REFNO = PROF_CARERS.PROCA_REFNO)
INNER JOIN (PROF_CARERS AS HCPs INNER JOIN REFERENCE_VALUES AS PRTYP ON HCPs.PRTYP_REFNO = PRTYP.RFVAL_REFNO) ON (SCP.PROCA_REFNO = HCPs.PROCA_REFNO)
INNER JOIN SPECIALTIES ON SCP.SPECT_REFNO = SPECIALTIES.SPECT_REFNO)
INNER JOIN SERVICE_POINTS ON SCP.SPONT_REFNO = SERVICE_POINTS.SPONT_REFNO) ON HEALTH_ORGANISATIONS.HEORG_REFNO = SERVICE_POINTS.HEORG_REFNO)
INNER JOIN REFERENCE_VALUES AS ADCAT ON SCP.ADCAT_REFNO = ADCAT.RFVAL_REFNO

WHERE
((SCP.START_DTTM)
Between '12/1/2010' And '1/1/2011');


Error message:
Msg 102, Level 15, State 1, Line 33
Incorrect syntax near ')'.

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2011-11-18 : 06:01:41
Just take out all your brackets as they are not required.
Go to Top of Page

satya068
Posting Yak Master

233 Posts

Posted - 2011-11-18 : 06:04:59
Thanks RickD
Go to Top of Page
   

- Advertisement -