Reputation: 158
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$$
Upvotes: 0
Views: 32
Reputation: 637
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"
Upvotes: 1