I have a query like this:

```
DELETE FROM rules_table
WHERE
    type1 = (
        SELECT type_id
        FROM types_table
        WHERE name = '<some_name>')
OR
    type2 = (
        SELECT type_id
        FROM types_table
        WHERE name = '<some_name>')

```

*Please note that `<some_name>` is the same in both occurrences*

I submit a query from php script and I'd prefer it to be a single request rather then selecting the type\_is with one request, parsing the result and submitting the delete request.

And also as far as I know, running the same `SELECT` statement two times is also a bad idea.