Solved

SyBase SQL Querry Syntax

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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 …
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
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 …

713 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