| Author: sudha 24 Dec 2008 | Member Level: Silver | Rating:  Points: 2 |
This would fetch all the users who have not logged in since 10 days....
Getdate() gives 24th dec. getdate() -10 gives 14th dec ....
Hope this helps
|
| Author: VinC 24 Dec 2008 | Member Level: Silver | Rating:  Points: 3 |
according to above quary, it will give u a list of email addresses of a users of table "Users" where the column lastlogindate is less then the currecnt date - 10
that is if u will take getdate() = 12/24/2008 and u will place getdate-10 = 12/14/2008
so quary will be
select useremail from Users where lastlogindate < convert(datetime,'12/14/2008',101)
so records where last login date is from the begining to 14th of dec 2008 will be displayed...
:) enjoy
Thanks, VinC
|
| Author: Sriman N Vangala 24 Dec 2008 | Member Level: Diamond | Rating:  Points: 3 |
select useremail from Users where lastlogindate < GETDATE() - 10
is the select statement which retrieves all the usermail details from the table Users which contains the lastlogindate as ten days before the current date.
GETDATE() returns the current date i.e '2008-12-24 14:16:33.907'
so (GETDATE() - 10) means '2008-12-14'
so the above query returns all the usermail details from the table Users which contains the lastlogindate less than '2008-12-14'
|
| Author: Tejinder Singh Barnala 24 Dec 2008 | Member Level: Gold | Rating:  Points: 0 |
Sudha is absolutely right.
Many Thanks Tejinder Singh Barnala /*I have the simplest tastes. I am always satisfied with the best*/
|
| Author: dhwani 24 Dec 2008 | Member Level: Silver | Rating:  Points: 3 |
this query says that - Get those useremail who has logged in - before 10 days.
i.e. lastlogindate < GETDATE() - 10 In dis GETDATE() will get current date and subtract 10 days from current date.
so if currentdate is 24/12/08 thn dis query will give records of those usermails whose logindate<14/12/08
hope dis will help u -Dhwani
|
| Author: Santhosh Aravind 24 Dec 2008 | Member Level: Gold | Rating:  Points: 1 |
select useremail from Users where lastlogindate < dateadd(day,-10,getdate())
try this query
|