Solved

Select statement

Posted on 2011-09-12
2
272 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
T-SQL:  I Want "Summary"--Not "Detail" 6 22
Managing Columnstore Indexes 2 18
SQL Server Question 5 28
Sql Count with Select Distinct 4 27
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…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

895 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

12 Experts available now in Live!

Get 1:1 Help Now