SELECT * FROM categories,items WHERE categories.idcat=items.subcategorie AND items.id=last_error