Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DateAdd not working

Status
Not open for further replies.

RenaG

Programmer
May 3, 2011
132
US
Hi,

I have this in my WHERE:
SCH1.App_DtTm between dateadd(week, -7, '2013-02-01') and '2013-02-01'

I am looking for patients with a certain kind of record that is within the last 7 weeks.

I can see patients in the DB with a record dated 12/18/2012 or another one dated 1/2/2013 and these records aren't being selected. (BTW - the dateadd(week, -7, '2013-02-01') evaluates to 12/14/2012). SCH1.Appt_DtTm is a datetime field.

Can someone spot what I am doing wrong here?

TIA!
~rlg
 
Never mind - I figured it out.

The problem was with my join - I was using an inner join instead of a left outer join. [blush] How'd that get in there???

~rlg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top