Link to home
Start Free TrialLog in
Avatar of RadhaKrishnaKiJaya
RadhaKrishnaKiJaya

asked on

Need help with a query

Hi Experts,

I want to update student status if the date is joindate is more than 180 days old from todays date.

Update Students Set IsNew = 0
Where joindate - todaysdate > 180days	
	

Open in new window


Thanks in advance!
ASKER CERTIFIED SOLUTION
Avatar of Sam Jacobs
Sam Jacobs
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Subtracting the number from getdate will work but can be confusing and difficult if you want to do anything other that "days".

I find dateadd to be more readable:  dateadd(day, -180, getdate())
Avatar of RadhaKrishnaKiJaya

ASKER

Thank you so much!
You are most welcome.