使用两列数据计数

时间:2017-09-14 13:40:11

标签: mysql

我有一个进度列和一个电子邮件日期列。我想将3个结果作为变量:

First: Progress = 0
Second: Progress = 1, EmailDate == 0000-00-00 00:00:00
Third: Progress = 1, EmailDate !== 0000-00-00 00:00:00

目前我有以下内容:

SELECT Progress, COUNT(*) AS counter
FROM myTable
GROUP BY Progress

但是,它没有使用电子邮件日期,当我尝试使用它时,我得到零值。

1 个答案:

答案 0 :(得分:1)

class TestThread : public TThread {
    public:
        __fastcall TestThread(HWND in_msg) : msg(in_msg), TThread(false) {};
        virtual __fastcall ~TestThread(){};
    private:
        void __fastcall Execute(){
            // Next line leads to WaitForInputIdle blocking
            SendMessage(msg, WM_USER, NULL, NULL); 
            while(!Terminated) Sleep(1);
        }

        HWND msg;
};

class TFormA : public TForm{
    private:
        TestThread * testthread_p;
    public:
        __fastcall TFormA(TComponent* Owner){
            testthread_p = new TestThread(Handle);
        }
        virtual __fastcall ~TFormA(){}
};