Solved

SyBase SQL Querry Syntax

Posted on 2014-03-07
1
243 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

'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 …
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

705 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

17 Experts available now in Live!

Get 1:1 Help Now