我有以下表格:
http ://sqlfiddle.com/#!2/1e991/1
但是我有问题!我的查询的输出是:
DATE SLOT sum(SUCCESSFUL) SUCCESSFUL PERCENTAGE OTA_NAME USERS_SI
July, 02 2013 00:00:00+0000 2 120 120 41.6667 campana 2 50
July, 02 2013 00:00:00+0000 1 200 200 25 campana 2 50
July, 02 2013 00:00:00+0000 1 150 150 53.3333 campana 3 80
July, 01 2013 00:00:00+0000 2 100 100 20 campana 1 20
July, 01 2013 00:00:00+0000 3 440 440 4.5455 campana 1 20
July, 01 2013 00:00:00+0000 1 700 700 2.8571 campana 1 20
我需要一个相同日期和活动的成功总和,例如,我在 7 月 1 日有活动 1 三行,那么我需要将三行的成功相加,而活动 2 有两行,那么我需要总和两行的成功,并且与活动 3 为一行,那么我需要将同一行的成功相加。最后百分比是 sum(SUCCESSFUL) 和 USERS_SI 之间的除法
我需要的输出是:
DATE SLOT sum(SUCCESSFUL) SUCCESSFUL PERCENTAGE OTA_NAME USERS_SI
July, 02 2013 00:00:00+0000 2 320 120 41.6667 campana 2 50
July, 02 2013 00:00:00+0000 1 320 200 25 campana 2 50
July, 02 2013 00:00:00+0000 1 150 150 53.3333 campana 3 80
July, 01 2013 00:00:00+0000 2 1240 100 20 campana 1 20
July, 01 2013 00:00:00+0000 3 1240 440 4.5455 campana 1 20
July, 01 2013 00:00:00+0000 1 1240 700 2.8571 campana 1 20
Can you help me?