以下は、MSSQL 構文です。これを mysql に変換する方法
SELECT
_nextBillingDate = UB.NextBillingDate,
_billingFrequency = (CASE IFNULL(UB.BillingFrequency,0) WHEN 0 THEN
_defaultBillingFrequency ELSE UB.BillingFrequency END),
_isCompletelyCreditBilled = (CASE WHEN PO.ChargeAmount > 0 THEN 0 ELSE 1 END),
_ownerId = PO.OwnerId
FROM PaymentOrder PO
INNER JOIN UserBillingInfo UB ON PO.OwnerId = UB.OwnerId
WHERE PO.Id = _paymentOrderId