Solved

SyBase SQL Querry Syntax

Posted on 2014-03-07
1
246 Views
Last Modified: 2014-03-07
I am trying to return a sum only if it's > 0 else, I want to return 0.

This is what I have now.

Select sum(quan*costeach) from dba.posdetail where prodnum in (select prodnum
from dba.product where reportno = 993301) and transact = 100

Open in new window


If the sum is > 0 then return the sum, else return 0.
0
Comment
Question by:triphen
1 Comment
 

Accepted Solution

by:
triphen earned 0 total points
ID: 39914194
Never mind I got it :)

Select case when sum(quan*costeach)  > 0 then sum(quan*costeach) else '0' end from dba.posdetail where prodnum in (select prodnum from dba.product where reportno = 993301) and transact = 2001
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now