Welcome Guest, Not a member yet? Register   Sign In
Is it possible to do a `where id=(select id from table);` sql statement ?
#1

Hello,
I'd like to achieve this sql using the QueryBuilder class. Is it possible ?
Code:
UPDATE Series
  SET index = index+1
where index >= (SELECT index FROM Series WHERE field_id = 5)

-- or --

UPDATE Series
  SET index = ( SELECT max(index) FROM Series )
  WHERE field_id = 3

I'm currently using two different database calls (one select, one update), but since I'm using a very small amount of data, optimization is not a priority.
Actually learning CodeIgniter4 and creating a complex CMS system for fan-translations teams (Kagescan)
@LoganTann on GitHub // French // He-Him
Reply


Messages In This Thread
Is it possible to do a `where id=(select id from table);` sql statement ? - by ShinProg - 11-21-2021, 05:53 AM



Theme © iAndrew 2016 - Forum software by © MyBB