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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 query logic

Author  Topic 

sardinka
Posting Yak Master

142 Posts

Posted - 2005-07-28 : 10:05:32
I have 2 tables:
First table: empID,PlanID,groupID
Second: PlanID,groupID,EffectiveDate,TerminationDate,DeadlineDate
I need to show only employee with in spesific group who is not
enroll for the current month until deadline passed.

Example:
empID PlanID groupID
1 10 12
PlanID GroupID EffectiveDate Terminationdate DeadlineDate
10 12 08/01/2005 08/31/2005 08/15/2005
11 12 09/01/2005 09/31/2005 09/15/2005
9 12 08/01/2005 08/31/2005 08/15/2005

If I run it today I should not get any results back. If I run in
on 8/15/2005 I should get back data with palnID11.

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2005-07-28 : 17:14:36
Can you pls clarify? Perhaps some more data would make it clearer. As would a better explanation of how the fields work.

Tim
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-07-29 : 01:06:18
Refer this and post accordingly
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2005-07-29 : 01:11:45
is this what you're looking for? just supply the column to be used for criteria

select f.empid, f.planid from
first f join second on f.planid=s.planid
where [column for date criteria]< getdate()

HTH


--------------------
keeping it simple...
Go to Top of Page
   

- Advertisement -