Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SQL Query

Posted on 2014-02-03
2
Medium Priority
?
372 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 26

Accepted Solution

by:
wilcoxon earned 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
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 is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

730 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