#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    2
    Rep Power
    0

    Help for coloring the column


    Hello,
    I am new to databases and want help in below code:

    Select
    (CASE WHEN power<30 THEN (power,"Red") ELSE POWER
    END )
    from power_production;

    What I want is if the column 'power' has value less than 30 then I want to display those values in Red color, else I want to print it as it is.
    Output should look like this:

    Power
    100.00
    34.89
    22.14
    55.34
    12.3


    Is it something possible in MySQL?If yes, what is the correct syntax for it as I know the code printed in blue color is not correct and giving me an error?
  2. #2
  3. Hockey face
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    St. Catharines, Canada
    Posts
    8,147
    Rep Power
    1316
    You would do that in your front end application, not within mysql.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    2
    Rep Power
    0
    Originally Posted by Guelphdad
    You would do that in your front end application, not within mysql.





    hmmm...thought so...just wanted to confirm it once...thanks

IMN logo majestic logo threadwatch logo seochat tools logo