sql - Update largest date, matching two fields -
hi, i'm looking update last column in blank table. picture shows input , desired output. trying pick largest date workorder , state match.
i've tried couple different codes:
update mytable set mytable.orderstartdate = max(table2.earliestdate) mytable table2 (mytable.workorder = table2.workorder , mytable.state = table2.state) ;
"syntax error (missing operator) in query expression 'max(table2.earliestdate) mytable table2'."
update mytable set mytable.orderstartdate = ( select max(earliestdate) mytable table2 (mytable.workorder = table2.workorder , mytable.state = table2.state) ) ;
"operation must use updateable query"
edit - click tables link image.
write pl/sql code.
- first, select distinct workorder , state , capture in variables.
- now, iterate list , write query max date i.e. max(date) using work_order , state in clause. capture date.
- now, in same loop write update query setting max(date) , workorder , state in clause.
Comments
Post a Comment