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)
 creating field from criteria

Author  Topic 

dzabor
Posting Yak Master

138 Posts

Posted - 2010-02-10 : 22:21:56
I am creating a view in sql. In this view I want to pull data

select id from table1 t1
where t1.paid_thru >= '04/30/2010'
and t1.Join_date <= '12/31/2009'
and t1.asofdate = '01/31/2010'
and t1.old_chapter = 'CH'

I would like take this select statement and any data that falls into thee criteria to return a value into as field such as 'Active'

I have been searching around to figure out where to start with this, but can find nothing.

Help...

dz

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-02-10 : 22:24:38
quote:
I would like take this select statement and any data that falls into thee criteria to return a value into as field such as 'Active'

what exactly do you mean by this ?

Can you post some sample data and the expected result ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

dzabor
Posting Yak Master

138 Posts

Posted - 2010-02-10 : 22:47:39

Table = Membership
ID Member Type Join Date Status
101 K 01/01/2009 Renewal
102 M 03/30/2009 Renewal
103 H 01/03/2010 New

I would like to use the Member Type and Join Date
If member Type = H and Join Date > 01/01/2010 then populate the Status filed with 'New'.

Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-02-10 : 22:52:59
[code]
update m
set Status = 'New'
from Membership m
where [Member Type] = 'H' and [Join Date] > '20100101'
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

dzabor
Posting Yak Master

138 Posts

Posted - 2010-02-10 : 23:06:39
I guess I was over thinking that one!

Thanks!
Go to Top of Page
   

- Advertisement -