Results 1 to 5 of 5
Jun 27, 2012, 07:35 #1
How to personalize output when value in my sql query is positive?
First of all I must say that I am a newbie when it comes to MySQL Database.
Here is my problem.
The value of the field `Variable` in my qTable could be positive or negative.
For negative value I have the correct output e.g. -97.
I need the output e.g. +11 when the value of the field `Variable` is positive value.
I try this query, but I have this output: +-97
SELECT CASE WHEN INSTR('-', Variable) > 0 THEN Variable ELSE CONCAT('+', Variable) END 'Output' FROM qTable;
Can you explain any one or any sample code related this.
Your help would be very appreciated.
thanks for your time and hints.
Thanks in advance,
Chevy.Thanks you very much for your help
I'm really happy for your quickly answer.