Skip to content
Advertisement

Update row with select on same table

I’m trying to update row with same table query. Context:

I want to : For each row; if TEXT IS NULL; update it with TEXT value of row with same ID and LANG = ‘EN’.

What is the SQL request to do something like that ?

Advertisement

Answer

You don’t specify the database. The following is standard SQL:

In the event of duplicates, the following should work:

EDIT:

Of course, not all databases support all ANSI standard functionality. In MySQL, you would use a join instead:

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement