getdate minus 1 year

Hi all,

When updating our ticket history, if I want to delete our single ticket constituency simply based upon not having purchased tickets in the last year would this be the correct way to achieve this?

Cheers!

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

IF @constituency is not null

delete   a

from      tx_const_cust a

where   a.constituency = @constituency and

not exists (select * from lt_tkt_hist b

where a.customer_no = b.customer_no

and b.perf_dt > dateadd(year,-1,getdate()))

Parents Reply Children
No Data