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
 SQL Server Development (2000)
 I need your suggestions

Author  Topic 

sqlbee
Starting Member

11 Posts

Posted - 2003-10-02 : 11:04:37
CREATE TABLE [dbo].[MOPT] (
[ID] [smallint] NOT NULL ,
[AMOUNT] [MONEY] NOT NULL ,
[START_DATE] [DATETIME]NOT NULL,
COVERAGE_OPT CHAR(1) )

insert MOPT (ID,AMOUNT,START_DATE,COVERAGE_OPT) values (1, 11111, '1/1/1950', c)
insert MOPT (ID,AMOUNT,START_DATE,COVERAGE_OPT) values (2, 22222, '1/1/1950', c)
insert MOPT (ID,AMOUNT,START_DATE,COVERAGE_OPT) values (3, 32566, '1/1/1950', c)
insert MOPT (ID,AMOUNT,START_DATE,COVERAGE_OPT) values (4, 1452, '1/1/1950', c)
insert MOPT (ID,AMOUNT,START_DATE,COVERAGE_OPT) values (5, 21458, '1/1/1950',c)
insert MOPT (ID,AMOUNT,START_DATE,COVERAGE_OPT) values (6, 14785, '1/1/1950', c)

insert MOPT (ID,AMOUNT,START_DATE,COVERAGE_OPT) values (1, 11111, '1/1/2004', c)
insert MOPT (ID,AMOUNT,START_DATE,COVERAGE_OPT) values (2, 42566, '1/1/2004', c)
insert MOPT (ID,AMOUNT,START_DATE,COVERAGE_OPT) values (3, 22222, '1/1/2004', c)
insert MOPT (ID,AMOUNT,START_DATE,COVERAGE_OPT) values (4, 12566, '1/1/2004', c)
insert MOPT (ID,AMOUNT,START_DATE,COVERAGE_OPT) values (5, 22222, '1/1/2004', c)
insert MOPT (ID,AMOUNT,START_DATE,COVERAGE_OPT) values (6, 54566, '1/1/2004', c)

This time we need only those records that has a year(start_date) < year(getdate())
but as soon as we hit Jan 2004 we need only those records that has year(start_date)=year(getdate())and after 2004 also we will need these record untill we get new rates kicked in for some other year.
Is there a way I can achieve this.
Right now I am looking for is for this year and year 2004.

thanks.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-10-02 : 12:59:41
Please do not post twice just because your question hasn't been answered:

[url]http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=29558[/url]

Tara
Go to Top of Page
   

- Advertisement -