mysql – php pdo where clauses-ThrowExceptions

Exception or error:

I am trying to add more than one where clause to the statement but was unable to do so. the 3rd line from last i want to add 2 more conditions, how to do that? where isdone = -1 and name = “something”

here is what i tried:

$conn = new PDO("mysql:host=$servername;dbname=timeclock", $username, $password);
        // set the PDO error mode to exception
        $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

                $res = $conn->query("SELECT oracleid
                     , name 
                     , des 
                     , clockingindate
                     , clockingoutdate  
                     , timediff(clockingoutdate, clockingindate) as duration
                     , total
                FROM attendance_records
                     JOIN (
                            SELECT oracleid
                                 , sec_to_time(sum(timestampdiff(SECOND, clockingindate, clockingoutdate))) as total
                            FROM attendance_records
                            where isdone =-1
                            GROUP BY oracleid
                          ) tots USING (oracleid)
                          where isdone =-1
                ORDER BY oracleid, clockingindate
How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *