SQL: SELECT a.*, ap.aid AS payed FROM [Table]attachments a LEFT JOIN [Table]attachpaymentlog ap ON ap.aid=a.aid AND ap.uid='0' WHERE a.pid IN (-1,887714) Error: Table '.\pspper\[Table]attachments' is marked as crashed and should be repaired Errno.: 145