0

I have a database which comprises of four columns but i would like to display the last column (iActive), which has values 1 and 0 only under it as( if 1 Display as Active else if 0 display as In-active) in my formload gridview. I tried with case method too but doesn't work.
Below is my gridview stored procedure

DROP PROCEDURE IF EXISTS `sp_chargegridview`$$

CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_chargegridview`()
BEGIN
    SELECT chargeRate AS `Charge Rate`, TransDate AS `Transaction Date`, iActive AS `Active`
    FROM t_pi_msg_charge_rate;
    SELECT DataID,
    CASE iActive
    WHEN "1" THEN Active
    WHEN "0" THEN Inactive
    END AS Active
    FROM t_pi_msg_charge_rate;

END$$
0

1 Answer 1

1

I'm not sure, but try

SELECT DataID,
CASE 
WHEN iActive == "1" THEN "Active"
WHEN iActive == "0" THEN "Inactive"
END AS "Active"
FROM t_pi_msg_charge_rate;

//edit if iActive is integer and not string, remove quotes from "0" and "1"

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.