<!--merge queries on the Send method--
<!--Find all eligible marketing activities--
<select id= "Crm-mk-act-define-select" resultmap= "Rm-mk-act-define-info" >
Select Mad.msg_def_name, Mad.msg_def_type,mad.msg_def_content,mad.id,
Mad.act_start_date,mad.act_end_date,mad.remark,mad.created_user,masw.name from
Mk_act_define Mad Left JOIN (select *,group_concat-sent_way_value = ' SMS ' Then ' text message ' when sent_way_value = ' Mail ' Then ' mail ' End SEPARATOR '; ') As NAME
From Mk_act_sent_way GROUP by msg_def_id) MASW on (mad.id=masw.msg_def_id)
where mad. ' Status ' = ' 1 '
<!--<! [Cdata[and Msg_def_type <> ' BIRTHDAY ']]>--
<dynamic>
<isnotempty property= "Mkactdefine.id" prepend= "and" >
Mad.id= #mkactdefine. id#
</isNotEmpty>
<isnotempty property= "Mkactdefine.msgdefname" prepend= "and" >
Mad.msg_def_name= #mkactdefine. msgdefname#
</isNotEmpty>
<isnotempty property= "Mkactdefine.idlist" prepend= "and" >
Mad.id
<iterate property= "mkactdefine.idlist" close= ")" open= "in ("
Conjunction= "," >
<! [cdata[
#mkactdefine. idlist[]#
]]>
</iterate>
</isNotEmpty>
<isnotnull property= "Mkactdefine.actenddate" prepend= "and" >
<! [cdata[
Mad.act_end_date > Date_add (current_date (), Interval-1 Day)
]]>
</isNotNull>
</dynamic>
ORDER BY mad.created_date Desc
LIMIT #limitStart #, #pageSize #;
</select>
Group_concat MySQL
The Oracle Wm_concat (column) function allows us to use it frequently, and below teaches you how to use the Oraclewm_concat (column) function to implement a field merge if you have an Oracle Wm_concat (column) If you are interested in the use of functions, you may wish to take a look.
Shopping:
-----------------------------------------
U_ID Goods num
------------------------------------------
1 Apples 2
2 Pear 5
1 Watermelon 4
3 Grapes 1
3 Banana 1
1 Oranges 3
=======================
The desired result is:
--------------------------------
u_id Goods_sum
____________________
1 apples, watermelon, oranges
2 Pears
3 Grapes, Banana
---------------------------------
- Select u_id, Wmsys.wm_concat (goods) goods_sum
- From shopping
- GROUP BY u_id
Desired result 2:
--------------------------------
u_id Goods_sum
____________________
1 apples (2 kg), watermelon (4 kg), Orange (3 kg)
2 pears (5 kg)
3 grapes (1 kg), banana (1 kg)
---------------------------------
Using the Oracle Wm_concat (column) function:
- Select u_id, wmsys.wm_concat (Goods | | ' (' | | | num | | ' kg ') goods_sum
- From shopping
- GROUP BY u_id
SQL merge fields