> > I have an UPDATE query with the following general structure: > > UPDATE table1 SET (SELECT field FROM table2 WHERE conditions ORDER BY > order_field LIMIT 1)
assuming you mean this, and you are happy with its performance.
UPDATE table1 SET field1 = (SELECT field FROM table2 WHERE conditions ORDER BY
order_field LIMIT 1)
> Is it possible to assign a default value in case no results are returned by > the SELECT statement?
use coalesce.
UPDATE table1 SET field1 = coalesce( (SELECT field FROM table2 WHERE conditions ORDER BY order_field LIMIT 1) , default_value )