2011-02-02 92 views
1

好吧,所以我有這個數組。目前它支付多筆付款金額和日期,如果表中有多筆付款。正如你在上面看到的那樣,它將它們分開。我只想要它拉出第一筆付款日期和金額。不是多個。我嘗試過的每件事都最終都會破壞事物。任何幫助,將不勝感激。我完全被難住了。php mysql數組限制

'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

這是一個浩浩蕩蕩的`'table'`值有... – BoltClock 2011-02-02 02:09:13

+1

你能使其更具可讀性 - 而不是一條線 – bensiu 2011-02-02 02:09:26

回答

0
在你的回報$

X =爆炸(」 '$行[' payments_dates']);並使用$ X [0]

同樣與payments_amounts