Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select with a IF condition? 1

Status
Not open for further replies.

meny21

IS-IT--Management
Oct 4, 2002
101
MX
Hi Guys,

Do you know how can I do this in classic Select?

I have a field in my table that has negative values and positive values, for example:

-1
-4
5
6
343
-34

I need just to put this in my select:

Select MyField
From MyTable

But MyField if the value is positive to put "Positive" and if this is negative to put "negative", is that possible?

For example this will be the result:

Negative
Negative
Positive
Positive
Positive
Negative

Thanks for any suggestions!

MR


 
You should do a little research on the Case/When construct. Google is your friend. If you attempt something, and it doesn't work, then post the code here and we will help further.

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Go to Start>Programs>Microsoft SQL Server>Books OnLine (for SQL 2000) Or Documentation and Tutorials>Books OnLine (for SQL 2005). Look up CASE in there.

-SQLBill

The following is part of my signature block and is only intended to be informational.
Posting advice: FAQ481-4875
 
Come on George, let me just give him the anwser. [noevil]

Well Done is better than well said
- Ben Franklin
 
Hi Guys,

It works!

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top