好的,所以我有这个阵列。目前,如果表付款中存在多个付款金额和日期,则会提取多个付款金额如上所述,它将它们分开。我只希望它能够提取第一个付款日期和金额。不是多个。我尝试过的一切都是在最后破坏事物。任何帮助,将不胜感激。我完全难过了。
'payment_info' => array(
'field' => 'payment_dates, payment_amounts, recurring_amount',
'table' => 'LEFT JOIN
(SELECT site_id,
CONVERT(GROUP_CONCAT(start_date SEPARATOR ", ")
USING latin1) AS payment_dates,
CONVERT(GROUP_CONCAT(amount SEPARATOR ", ")
USING latin1) AS payment_amounts
FROM payments
GROUP BY site_id
ORDER BY start_date) AS payment_info
ON sites.site_id = payment_info.site_id
LEFT JOIN
(SELECT site_id, amount AS recurring_amount
FROM recurring_payments
GROUP BY site_id
ORDER BY payment_id DESC) AS recurring_amount
ON sites.site_id = recurring_amount.site_id'
),
以下是完整文件的链接,以查看查询在数组中的位置:http://pastebin.com/DiB9Z67b
答案 0 :(得分:0)
在你的回报中$ x = explode(',',$ row ['payments_dates']);并使用$ x [0]
与payments_amounts相同