I’d like do something like this:
- In table TAGS find a row with name=’someName’, and remeber it’s id
- In the same table find another row with someCondition and set in this row col refference=the id from above
Tried to do this using a subquery, but mysql refused saying I can’t subquery a table that I’m updating in the main query.
How can I otherwise implement the above idea?
Thank you
you can do this
Not advisable though.
Edit#1 You can avoid the sub-queries altogether — as taspeotis rightly mentioned, by
joining the same table with the criteria. Here goes the code for that:This is a better approach.