1
SELECT        tbl_varsity_2.idnumber AS IDNUMBER, CONCAT(tbl_varsity_2.firstname, ' ', tbl_varsity_2.middlename, '. ', tbl_varsity_2.lastname) AS NAME, 
                         COALESCE(tbl_attendance_2.login, { d '0000-00-00 00:00:00' }) AS LOGIN, COALESCE(tbl_attendance_2.logout, { d '0000-00-00 00:00:00' }) AS LOGOUT, 
                         tbl_attendance_2.totaltime AS TOTALTIME, tbl_varsity_2.sport AS SPORT FROM            tbl_varsity tbl_varsity_2 LEFT JOIN
                         tbl_attendance tbl_attendance_2 ON tbl_varsity_2.idnumber = tbl_attendance_2.idnumber WHERE (tbl_varsity_2.status = 'active') AND(tbl_varsity_2.idnumber != ALL (SELECT tbl_varsity_5.idnumber FROM tbl_varsity tbl_varsity_5  INNER JOIN tbl_attendance tbl_attendance_5 ON tbl_varsity_5.idnumber=tbl_attendance_5.idnumber WHERE (tbl_attendance_5.login BETWEEN '2012-11-23 00:00:00' AND '2012-11-25 00:00:00') AND (tbl_varsity_5.status='active')))

結果10169060 2012-11-27 09:07:53 2012-11-27 14:08:03 です 。 -00 00:00:00 0000-00-00 00:00:00 バスケットボール女子 0000-00-00 00:00:00 0000-00-00 00:00:00

すべての値が 0000-00-00 00:00:00 になるように

助けてください

4

1 に答える 1

0

すべてのレコードに値を表示したい場合0000-00-00 00:00:00(条件を指定しなかったため)、select ステートメントで使用します。

SELECT tbl_varsity_2.idnumber AS IDNUMBER
    , CONCAT(tbl_varsity_2.firstname, ' ', tbl_varsity_2.middlename, '. ', tbl_varsity_2.lastname) AS NAME
    /*, COALESCE(tbl_attendance_2.login, { d '0000-00-00 00:00:00' }) AS LOGIN
    , COALESCE(tbl_attendance_2.logout, { d '0000-00-00 00:00:00' }) AS LOGOUT*/
    , '0000-00-00 00:00:00' AS LOGIN
    , '0000-00-00 00:00:00' AS LOGOUT
    , tbl_attendance_2.totaltime AS TOTALTIME
    , tbl_varsity_2.sport AS SPORT 
    FROM tbl_varsity tbl_varsity_2 
    LEFT JOIN tbl_attendance tbl_attendance_2 ON tbl_varsity_2.idnumber = tbl_attendance_2.idnumber 
    WHERE (tbl_varsity_2.status = 'active') 
        AND (tbl_varsity_2.idnumber != ALL (
                SELECT tbl_varsity_5.idnumber 
                    FROM tbl_varsity tbl_varsity_5  
                    INNER JOIN tbl_attendance tbl_attendance_5 ON tbl_varsity_5.idnumber=tbl_attendance_5.idnumber 
                    WHERE (tbl_attendance_5.login BETWEEN '2012-11-23 00:00:00' AND '2012-11-25 00:00:00') 
                        AND (tbl_varsity_5.status='active')
                )
            )
于 2012-11-28T04:09:22.160 に答える