sql - How do I update a subset of values in DB2 based on related tables? -
i trying remove last 10 characters clob field in db2 database. can using:
update report set comment = left(comment, (length(comment) - 10))
however, want limit truncation subset of rows based on whether or not report in current reporting period. tried this...
update report set comment = ( select left(comment, (length(comment) - 10)) report inner join report_period on report.report_period_id = report_period.report_period_id report_period.name = '2013 interim report' )
...but get
the result of scalar fullselect, select statement, or values statement more 1 row
what doing wrong?
never mind... asking question helped clear in head. had move join clause....
update report set comment = left(comment, (length(comment) - 10)) report_id in ( select report_id report inner join report_period on report.report_period_id = report_period.report_period_id report_period.name = '2013 interim report' )
Comments
Post a Comment