DELIMITER $$
DROP PROCEDURE IF EXISTS `updateAllOtherInsurance`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `updateAllOtherInsurance`(pIDs VARCHAR(1000))
BEGIN
DELETE FROM patientinsuranceelgihistory WHERE FIND_IN_SET(patientInsID, pIDs) > 0;
END$$
DELIMITER ;
Thursday, 16 October 2014
MYSQL How to pass list of values to Stored Procedure.
Wednesday, 15 October 2014
MYSQL Update From within the same table using some condition
In Some cases, we need to update the table of one row with the values of the other row on the same table. Here is the query to do the same.
UPDATE patientinsurance dest
JOIN ( SELECT
patientCode,
policyNo
FROM
patientinsurance
WHERE
ID = 121590
) AS source
ON dest.patientCode = source.patientCode
SET dest.policyNo = source.policyNo
WHERE dest.id IN (121911)
Subscribe to:
Posts (Atom)