Solved

Select statement

Posted on 2011-09-12
2
298 Views
Last Modified: 2012-05-12
I have a table with 3 columns

id, parentID, pmtAmount

I want a select on all...but where parentID <> id return pmtAmount * -1
Else pmtAmount
0
Comment
Question by:lrbrister
[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 18

Accepted Solution

by:
deighton earned 500 total points
ID: 36523874
select id, parentid,
      CASE WHEN parentID <> id THEN pmtAmount * -1 ELSE pmtAmount END
          AS pmtAmountAdjusted
FROM YourTable
0
 

Author Closing Comment

by:lrbrister
ID: 36524043
Thanks
0

Featured Post

Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

756 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