Solved

SQL Query

Posted on 2014-02-03
2
335 Views
Last Modified: 2014-02-03
SyBase SQL Anywhere v10

Hey guys,

I am trying to return a preset text result if a specific condition is met. Example:

select POSHEADER.transact, POSHEADER.snum, POSHEADER.statnum, whoclose, timeend, POSHEADER.finaltotal, POSHEADER.status, METHODPAY.descript……

I don’t want it to actually select the POSHEADER.finaltotal value, but rather return a result of “Sale” if finaltotal is > 0 and a result of “Return” if finaltotal is < or = 0. Also the returned value needs to be in column 6.
0
Comment
Question by:triphen
2 Comments
 
LVL 26

Accepted Solution

by:
wilcoxon earned 500 total points
ID: 39831392
select POSHEADER.transact,
POSHEADER.snum,
POSHEADER.statnum,
whoclose,
timeend,
case when POSHEADER.finaltotal > 0 then 'Sale' else 'Return' end,
POSHEADER.status,
METHODPAY.descript……

Open in new window

0
 

Author Closing Comment

by:triphen
ID: 39831535
Perfect....I had the same thing but my entire query was on one line.....it was working before I added the CASE statement. Thanks again!
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Query 26 64
MS SQL 2008 Divide by zero error encountered. Error 3 36
get column names from table in vb.net 8 29
SQL Insert parts by customer 12 34
I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
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 …

778 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