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 |
|
dzabor
Posting Yak Master
138 Posts |
Posted - 2011-03-03 : 15:55:04
|
| I am trying to use a subquery to pull a field in a script.select n.id,n.Last_Updated as 'Last Updated',(SELECT Case WHEN member_Type in('OWNER','EXEC','AFF','STU','HLM') THEN 'Member' else 'Guest Member' END as NewMemberTypefrom name ) as 'Member Type Code','' as 'Primary Group Code',n.Last_Name as 'Last Name',n.First_Name as 'First Name'from name nI get the error 'Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.'I tried to use Top 1, but it returns the same values for all, 'Member'.Any idea how I can get it to return that field value as 'Member' for the first set specified and 'Guest Member' for the rest?Thanks! |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
|
|
|
|
|