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
 Using cases

Author  Topic 

learzbu
Starting Member

27 Posts

Posted - 2011-11-14 : 15:05:31
Hi,

I'm trying to get use a case like:

select case when warehouse like '' then
scheme.opsahistm.val
else '0'
from scheme.opsahistm

What i want is from a table of invoices anything that was charged and has a a blank entry in the column warehouse ( this means it was freight or delivery charges) to get the value of this cost, other wise enter a 0 in freight (customer paid for their own frieght or it was discounted due to the purchase being over a certain amount)

Can anyone help with this?

Thanks!

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-11-14 : 15:08:02
select case when warehouse like '' then so.val else '0' end
from scheme.opsahistm so

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

learzbu
Starting Member

27 Posts

Posted - 2011-11-14 : 15:14:14
Thanks
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-11-14 : 15:15:19
You're welcome, glad to help.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -