October 21, 2024
Chicago 12, Melborne City, USA
SQL

Update Set for a column


This is a sample table and I would like to update the column ‘TYPE’ as like the value which is there ‘STOCKIN’ /’STOCKOUT’ for the particular DOCNUM in each row.

Sample Table

CODE DOCNUM TYPE
Z01 NUM12 stockin
Z01 NUM12 null
Z01 NUM12 null
Z01 NUM12 null
Z01 NUM134 stockout
Z01 NUM134 null
Z01 NUM134 null
Z01 NUM134 null

Expected table

CODE DOCNUM TYPE
Z01 NUM12 stockin
Z01 NUM12 stockin
Z01 NUM12 stockin
Z01 NUM12 stockin
Z01 NUM134 stockout
Z01 NUM134 stockout
Z01 NUM134 stockout
Z01 NUM134 stockout

Please help me how can I update the column Type for each row as per the DOCNUM.



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video