MySQL错误"无效使用组功能错误代码:1111"

时间:2017-07-17 10:15:53

标签: mysql sql

我只是在下面使用我的脚本查询:

Ext.create('Ext.grid.Panel', {
    margin: '30 2 0 0',
    layout: 'fit',
    scrollable: 'vertical',
    cls: 'logTimeInTask',
    bodyCls: 'scrollBar',
    renderTo:Ext.getBody(),
    maxHeight: 400,
    title: 'timeEntryDetail',
    scrollable: true,
    collapsible: false,
    columnLines: false,
    expandOnDblClick: false,
    viewConfig: {
        preserveScrollOnRefresh: true,
        preserveScrollOnReload: true
    },
    columns: [{
        text: 'timeLoggedBy',
        menuDisabled: true,
        sortable: false,
        flex: 1,
        renderer: function (value, p, record) {
            var retDataStr = '';
            retDataStr += Ext.String.format('<span>{0}</span>', record.data.creator);
            return retDataStr
        }
    }, {
        text: 'time',
        sortable: false,
        menuDisabled: true,
        width: 120,
        renderer: function (value, p, record) {
            var retDataStr = '';
            if (record.data.logged_hours != null) {
                retDataStr += record.data.logged_hours + 'h ';
            }
            if (record.data.logged_mins != null) {
                retDataStr += record.data.logged_mins + 'm ';
            }
            return retDataStr;
        }
    }, {
        text:'date',
        sortable: false,
        menuDisabled: true,
        width: 100,
        renderer: function (value, p, record) {
            return record.data.date;
        }
    }, {
        text: 'status',
        sortable: false,
        menuDisabled: true,
        dataIndex: 'status',
        width: 120,
        renderer: function (value, p, record) {
            return Ext.String.capitalize(record.data.status);
        }

    }],
    plugins: [{
        ptype: 'rowexpander',
        rowBodyTpl: new Ext.XTemplate(
            '<p><b>timesheet:</b> {timesheet}</p>',
            '<tpl if="description!=null">',
            '<p><b>description:</b> {[this.showDescription(values)]}</p>',
            '</tpl>', {
                showDescription: function (values) {
                    return values.description;
                }
            }
        )
    }],
    listeners: {
        render: function (grid) {
                var timeEntryDetailStore = new Ext.data.JsonStore({
                    data: [{"id":80930195009,"status":"none","description":"dfsgdfsgsd\nfg\ndsf\ng\ndsf\ng\nsdfg\nsdfg","date":"2017-07-17","created_at":"2017-07-17T09:38:32+00:00","logged_hours":3,"logged_mins":54,"timer":false,"timesheet":"111111111111","task_id":14763865922,"sort":0,"project":909679456,"project_name":"wwwwwwwwwwwwwww","creator":1270919337},{"id":80930208578,"status":"none","description":"dsfv dfd sfg\ndsf \ng\ndfsg \ndfsg\n\ndsg\nds\ng\ndfs\ngdsfg\n dfg","date":"2017-07-17","created_at":"2017-07-17T09:39:04+00:00","logged_hours":12,"logged_mins":4,"timer":false,"timesheet":"111111111111","task_id":14763865922,"sort":0,"project":909679456,"project_name":"wwwwwwwwwwwwwww","creator":1270919337},{"id":80930222146,"status":"none","description":"So the problem here is whenever we open a popup window ExtJS library is needed and it is taking up a lot of memory in IE.\n\nIs there any other way we can load a browser window popup with ExtJS grid without loading the whole ExtJS framework?\n\nOr any other idea are most welcome, as we are really facing a lot of memory issues in IE and users are not willing to use chrome.","date":"2017-07-17","created_at":"2017-07-17T09:39:38+00:00","logged_hours":4,"logged_mins":3,"timer":false,"timesheet":"111111111111","task_id":14763865922,"sort":0,"project":909679456,"project_name":"wwwwwwwwwwwwwww","creator":1270919337},{"id":80930235715,"status":"none","description":"So the problem here is whenever we open a popup window ExtJS library is needed and it is taking up a lot of memory in IE.\n\nIs there any other way we can load a browser window popup with ExtJS grid without loading the whole ExtJS framework?\n\nOr any other idea are most welcome, as we are really facing a lot of memory issues in IE and users are not willing to use chrome.","date":"2017-07-17","created_at":"2017-07-17T09:39:44+00:00","logged_hours":3,"logged_mins":54,"timer":false,"timesheet":"111111111111","task_id":14763865922,"sort":0,"project":909679456,"project_name":"wwwwwwwwwwwwwww","creator":1270919337},{"id":80930249284,"status":"none","description":"So the problem here is whenever we open a popup window ExtJS library is needed and it is taking up a lot of memory in IE.\n\nIs there any other way we can load a browser window popup with ExtJS grid without loading the whole ExtJS framework?\n\nOr any other idea are most welcome, as we are really facing a lot of memory issues in IE and users are not willing to use chrome.","date":"2017-07-17","created_at":"2017-07-17T09:39:50+00:00","logged_hours":39,"logged_mins":2,"timer":false,"timesheet":"111111111111","task_id":14763865922,"sort":0,"project":909679456,"project_name":"wwwwwwwwwwwwwww","creator":1270919337},{"id":80930262852,"status":"none","description":"So the problem here is whenever we open a popup window ExtJS library is needed and it is taking up a lot of memory in IE.\n\nIs there any other way we can load a browser window popup with ExtJS grid without loading the whole ExtJS framework?\n\nOr any other idea are most welcome, as we are really facing a lot of memory issues in IE and users are not willing to use chrome.","date":"2017-07-17","created_at":"2017-07-17T09:39:57+00:00","logged_hours":3,"logged_mins":54,"timer":false,"timesheet":"111111111111","task_id":14763865922,"sort":0,"project":909679456,"project_name":"wwwwwwwwwwwwwww","creator":1270919337}]
                });
                grid.setStore(timeEntryDetailStore);

        }
    }
})

当我尝试运行时,它有错误:

  

错误代码1111.无效使用组功能。

使用表line_bgw.BGW_HIS_TB的那些查询,其列与DATE,MSISDN,CARRIER,PROD_ID一样。

3 个答案:

答案 0 :(得分:1)

您无法在SUM参数中嵌套SUM(IF(CARRIER = '101' AND PROD_ID = 'ST', COUNT(DISTINCT MSISDN), 0))

而不是:

COUNT(DISTINCT IF(CARRIER = '101' AND PROD_ID = 'ST', MSISDN, NULL))

执行:

$sql2 = "SELECT TIME_TO_SEC(TIMEDIFF(NOW(), time)) FROM database WHERE id = 1";
$result = $conn->query($sql2);

if ($result >= 86400) { 
    $sql5 = "UPDATE points SET value = 1 WHERE id = 1"; 
    $result = $conn->query($sql5);
    $sql6 = "UPDATE points SET time = NOW() WHERE id = 1";
    $result = $conn->query($sql6);
}

答案 1 :(得分:1)

我怀疑你想要:

SELECT DATE_FORMAT(REG_DT, '%Y-%m-%d') as DT2,
       COUNT(DISTINCT CASE WHEN CARRIER = 101 AND PROD_ID = 'ST' THEN MSISDN) as "TSEL ST",
       . . .
FROM BGW_HIS_TB
WHERE REG_DT >= '2017-07-01' AND
      REG_DT < '2017-08-01' AND
      STATUS = 'S'
GROUP BY DT2
ORDER BY DT2;

注意:

  • 我认为你想要COUNT(DISTINCT),而不是SUM()。这是猜测。
  • 我猜这个状态是一个不是字符串的数字。如果是这样,则应将其与数字进行比较。因此101而不是'101'
  • 我简化了日期比较。通常,使用日期BETWEEN并不明智。

答案 2 :(得分:0)

SELECT DATE_FORMAT(REG_DT, '%Y-%m-%d') DT2,
SUM(CASE WHEN CARRIER = '101' AND PROD_ID = 'ST' THEN 1 ELSE 0 END )'TSEL ST',
SUM(CASE WHEN CARRIER = '103' AND PROD_ID = 'ST' THEN 1 ELSE 0 END )'XL ST'
 FROM BGW_HIS_TB
WHERE REG_DT BETWEEN '2017-07-01 00:00:00' AND '2017-07-31 23:59:59'
   AND STATUS = 'S'
GROUP BY DATE_FORMAT(REG_DT, '%Y-%m-%d') ORDER BY 1 ASC;
create table BGW_HIS_TB (CARRIER varchar(255),PROD_ID varchar(255),MSISDN varchar(255),REG_DT date)

您可以尝试以上查询。