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
 General SQL Server Forums
 New to SQL Server Programming
 Sub query as field

Author  Topic 

dzabor
Posting Yak Master

138 Posts

Posted - 2011-08-24 : 18:56:37

I am trying to use a subquery as a field in a select statement. The last field is where I am having trouble with the syntax.

Select Order_GL AS Type, CustomFieldValue AS OrderGLAccount, when OP.CheckNumber like '%CASH%' then '0325-100-1011-0000' else CustomFieldValue AS TypeGLAccount
from orders


Thanks,
DZ

dzabor
Posting Yak Master

138 Posts

Posted - 2011-08-24 : 19:05:07
I figureed it out already as soon as I hit submit. :)
Go to Top of Page

gwilson67
Starting Member

42 Posts

Posted - 2011-08-25 : 00:16:59
Don't you love it when you figure out the problem yourself?

Greg
http://www.freewebstore.org/tsqlcoderepository
Powerful tool for SQL Server development
Go to Top of Page
   

- Advertisement -