Skip to Content
0
Former Member
Nov 18, 2010 at 05:52 PM

Getting DATEADD syntax error

110 Views

Hi ya'll. I am writing a SQL query and I keep getting a syntax error with the DATEADD function. Can anyone help me to figure out the error? I have looked it up and I believe the syntax to be correct. Query is below:

SELECT 

c.div, 
c.scm_active,
c.scm_cntrgrp, 
c.scm_ctr_dt, 
c.scm_ctr_no, 
c.scm_end_dt, 
c.scm_name, 
c.scm_renew_no,
s.seh_ctr_no,
s.seh_hrs insp_hrs,
s.seh_ins_cd,
s.seh_month,
s.seh_renew_no,
DATEADD("m",s.seh_month-1,c.scm_ctr_dt) insp_mo

FROM

Sm_cntrt c

LEFT JOIN
sm_cmeihr s on c.scm_ctr_no = s.seh_ctr_no and
               c.scm_renew_no = s.seh_renew_no



WHERE
c.scm_active = 'a' and
c.scm_ctr_no = 'g0420602'

The error is "Syntax error in SQL statement at or about ") insp_mo FROM sm_cntrt c LEFT"

Thanks, I sure do appreciate the help!!!

Marlene

Crystal Reports XI

Edited by: Marlene Human on Nov 18, 2010 12:52 PM