I think mysql variables should be used, like:
```sql
SELECT @drug_order_type_id := order_type.order_type_id  FROM order_type WHERE order_type.java_class_name LIKE "org.openmrs.DrugOrder";

UPDATE orders SET orders.order_type = @drug_order_type_id WHERE orders.order_id IN (SELECT drug_order.order_id FROM drug_order);
```