Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
unikoman
Starting Member
32 Posts |
Posted - 2006-02-20 : 05:14:24
|
| Hi AllI have built this query :Select position, SubsidiaryNamefrom positionWhere SubsidiaryName in ('country1','country2')and position not like('testuser_%')and position not like ('Inactive_%')and position not like('olduser_%');However when I run it, the result more accounts in country 1 than expected. I think it could be inactive users who have not logged into this system for 6 months or more. How can I build a query that incorporates my original query + shows only users who logged into the past 6 months ? |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-02-20 : 05:24:43
|
| Select position, SubsidiaryNamefrom positionWhere SubsidiaryName in ('country1','country2')and LoggedDate>=DateAdd(day,dateDiff(day,0,DateAdd(month,-6,getdate())),0)and position not like('testuser_%')and position not like ('Inactive_%')and position not like('olduser_%');MadhivananFailing to plan is Planning to fail |
 |
|
|
unikoman
Starting Member
32 Posts |
Posted - 2006-02-20 : 05:30:22
|
| thanks Madhivanan:) you are a legend:) |
 |
|
|
|
|
|