SQL: [499] select count(*) total_row from (select A.`id`, A.`status`, A.date_created, (select payment_status from ap_form_payments where record_id=A.`id` and form_id = ?) payment_status from ap_form_243626 A where A.`status` = 1) B where (B.`payment_status` = 'paid' and B.`status` = 1) OR (B.`payment_status` is null and B.status = 1 and B.date_created > now()-interval 30 minute) Sent SQL: [506] select count(*) total_row from (select A.`id`, A.`status`, A.date_created, (select payment_status from ap_form_payments where record_id=A.`id` and form_id = '243626') payment_status from ap_form_243626 A where A.`status` = 1) B where (B.`payment_status` = 'paid' and B.`status` = 1) OR (B.`payment_status` is null and B.status = 1 and B.date_created > now()-interval 30 minute) Params: 1 Key: Position #0: paramno=0 name=[0] "" is_param=1 param_type=2 Query Failed: SQLSTATE[21000]: Cardinality violation: 1242 Subquery returns more than 1 row