Let say you have a query that return multiple row, but you want it return in single line separated by comma.
Example query that returns result in rows:
SELECT invoiceNo FROM payment WHERE paymentStatus = '3' AND paymentYear = DATE_FORMAT(now(),'%Y') AND paymentAmountNett != '0.00' and billpaymentChannel='Cap';
SELECT GROUP_CONCAT(DISTINCT(invoiceNo) SEPARATOR ',') FROM payment WHERE paymentStatus = '3' AND paymentYear = DATE_FORMAT(now(),'%Y') AND paymentAmountNett != '0.00' and billpaymentChannel='Cap';
No comments:
Post a Comment