I have tried this below without success, it just fails because table\_B is empty. So I want to at least delete the record from table\_A even if table\_B is empty.

FYI: table\_A record always exists, so no need to search if that exists.

```
$sql_remove_rfid = $dbi->prepare("
DELETE 
  FROM table_A
     , table_B
  LEFT 
  JOIN table_B 
    ON table_A.id = table_B.key
WHERE table_A.id=?");

```