group_concat的sql查询问题

时间:2014-04-30 12:39:08

标签: php mysql sql sql-server-2008

以下查询工作正常

 SELECT listing_offer . * , (

SELECT GROUP_CONCAT( c1.card_name )
FROM merchant_card AS c1
WHERE FIND_IN_SET( c1.id, listing_offer.cc_ids )
) AS cardname, (

SELECT GROUP_CONCAT( c2.outlet_name )
FROM merchant_employer AS c2
WHERE FIND_IN_SET( c2.id, listing_offer.outlet_id )
) AS outletname
FROM `listing_offer`
ORDER BY listing_offer.id

和我试图在我公司的mvc结构上实现相同 但似乎没有工作。

$obj_model_coupon = $this->app->load_model("listing_offer");
        $rs = $obj_model_coupon->execute("SELECT", true, "

SELECT GROUP_CONCAT( c1.card_name )
FROM merchant_card AS c1
WHERE FIND_IN_SET( c1.id, listing_offer.cc_ids )
 AS cardname, (

SELECT GROUP_CONCAT( c2.outlet_name )
FROM merchant_employer AS c2
WHERE FIND_IN_SET( c2.id, listing_offer.outlet_id )
) AS outletname
ORDER BY listing_offer.id","", "");

0 个答案:

没有答案