-
DateAdd Function
I programmed the following query to add 10 years to the return of i.fldimmdate.
When I run this all I receive is the date 1/1/1900 for all dates returned in the query. I understand that this means that I'm dividing by zero in integer math, but I have been unable to figure out how to use DateAdd() correctly. Any help is appreciated.
CREATE VIEW iTetDip
AS
SELECT DATEADD(yyyy,10, MAX(i.fldimmdate)) flddate
,d.fldkey
FROM tblimmunizations i
,lovimms l
,tbldemographics d
WHERE l.fldname IN (SELECT l.fldname
FROM lovimms l
WHERE l.fldname LIKE 'Tetanus Diptheria'
AND d.fldkey = i.fldpatientid
AND i.fldimmcodeid = l.fldkey
AND d.fldfmp = '20'
AND d.fldbenstat = 'AD'
AND d.fldrecordstatus = '1'
GROUP BY d.fldkey
-
DateAdd Function (reply)
Instead of YYYY use year.
select dateadd(year,10,getdate())
HTH.
Jaya
------------
Mark at 6/22/01 4:24:20 PM
I programmed the following query to add 10 years to the return of i.fldimmdate.
When I run this all I receive is the date 1/1/1900 for all dates returned in the query. I understand that this means that I'm dividing by zero in integer math, but I have been unable to figure out how to use DateAdd() correctly. Any help is appreciated.
CREATE VIEW iTetDip
AS
SELECT DATEADD(yyyy,10, MAX(i.fldimmdate)) flddate
,d.fldkey
FROM tblimmunizations i
,lovimms l
,tbldemographics d
WHERE l.fldname IN (SELECT l.fldname
FROM lovimms l
WHERE l.fldname LIKE 'Tetanus Diptheria'
AND d.fldkey = i.fldpatientid
AND i.fldimmcodeid = l.fldkey
AND d.fldfmp = '20'
AND d.fldbenstat = 'AD'
AND d.fldrecordstatus = '1'
GROUP BY d.fldkey
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|