1 select ROW_NUMBER() OVER(order by CC.menu_date, CC.cai_type asc) as row1,2 CC.*3 from (select B1.Menu_Date,4 B1.Cai_Type,5 LISTAGG(B2.CAI_NAME, ',') WITHIN GROUP(order by B1.Cai_Type)6 from customer_menu_config B1, Cai B27 where B1.Cai_Code = B2.Cai_Code8 and B1.CUSTOMER_MENUID = '1701'9 group by B1.Menu_Date, B1.Cai_Type) CC
SQL> desc customer_menu_configName Type Nullable Default Comments --------------- ---------- -------- ------- --------- CUSTOMER_MENUID NUMBER(10) Y MENU_DATE DATE Y CAI_TYPE NUMBER(2) Y 1.早餐 2.正餐 CAI_CODE NUMBER(10) Y WEIGHT NUMBER(10) Y 默认单位g ORGAN_ID NUMBER(10) Y
1 2015/4/2 1 绿豆百合杂粮粥,煮鸡蛋
2 2015/4/2 2 金钩烧冬瓜,莲蓬扣肉,米饭,肉末虎皮豆腐
3 2015/4/2 3 蒲菜粥,虾仁菠菜,蒸饼卷菜
4 2015/4/3 1 白菜炒木耳,鲜藕粥
5 2015/4/3 2 豆腐结烧肉,梅菜蒸苦瓜,米饭,丝瓜炒蛋
6 2015/4/3 3 黄鱼粥,香菇油菜,燕麦苦瓜娘
7 2015/4/4 1 皮蛋青菜瘦肉粥,煮鸡蛋
8 2015/4/4 2 冬枣凤尾虾,清炒西瓜皮,西葫芦炒香肠
9 2015/4/4 3 冬瓜汤,粉蒸肉,小茴香炒蛋
10 2015/4/5 1 八宝粥,玉米馒头
11 2015/4/5 2 白粥,红烧千页豆腐,虾饺,香菇西兰花
12 2015/4/5 3 白粥,芹菜豆丝,煮鸡蛋
13 2015/4/6 1 锅巴粥,蒸鱼糕
14 2015/4/6 2 冬瓜汤,红枣蒸三鲜,米饭,西葫芦炒蛋
15 2015/4/6 3 黑米粥,西芹木耳虾仁,香菇素炒双丝
16 2015/4/7 1 凉拌腐竹,小麦豆角粥
17 2015/4/7 2 白菜肉片,凉拌豆芽,米饭,清汤羊肚
18 2015/4/7 3 挂面,素烧面筋,杏仁西芹炒虾仁
19 2015/4/8 1 发糕,南瓜粥
20 2015/4/8 2 虫草花排骨莲藕汤,腊八豆拌金针菇
21 2015/4/8 3 石鱼煎蛋,招财进宝爽口菜
22 22 2015/4/9 1 绿豆百合杂粮粥,煮鸡蛋
23 23 2015/4/9 2 金钩烧冬瓜,莲蓬扣肉,米饭,肉末虎皮豆腐
24 24 2015/4/9 3 蒲菜粥,虾仁菠菜,蒸饼卷菜