Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2017
    Posts
    12

    Question Unanswered: how to copy one column into another in DB2 sql

    how to copy one column into another using db2 sql query
    I know copy column using update and set command bt in my query it gives me error
    i want to copy owner_2,owner_3 into owner_1 and resource2,resource3 into resourc1

    what command i can use here,
    Please anybody correct me

    Here is my query
    SELECT DISTINCT T1.PROJECT_NAME,
    T1.REFERENCE_ID,
    T1.NAME AS URL1_title,
    T1.URL AS URL1,
    T1.REQUEST_TYPE,
    T2.VAL,
    T3.VAL AS VAL1,
    T4.VAL AS VAL2,
    T5.VAL AS VAL3,
    T6.VAL AS VAL4,
    T7.VAL AS VAL5
    FROM RIDW.VW_REQUEST T1
    LEFT OUTER JOIN RICALM.VW_RQST_STRING_EXT T2
    ON T2.REQUEST_ID=T1.REQUEST_ID AND T2.NAME='owner_1'
    LEFT OUTER JOIN RICALM.VW_RQST_STRING_EXT T3
    ON T3.REQUEST_ID=T1.REQUEST_ID AND T3.NAME='owner_2'
    LEFT OUTER JOIN RICALM.VW_RQST_STRING_EXT T4
    ON T4.REQUEST_ID=T1.REQUEST_ID AND T4.NAME='owner_3'
    LEFT OUTER JOIN RICALM.VW_RQST_DECIMAL_EXT T5
    ON T5.REQUEST_ID=T1.REQUEST_ID AND T5.NAME='resource1'
    LEFT OUTER JOIN RICALM.VW_RQST_DECIMAL_EXT T6
    ON T6.REQUEST_ID=T1.REQUEST_ID AND T6.NAME='resource2'
    LEFT OUTER JOIN RICALM.VW_RQST_DECIMAL_EXT T7
    ON T7.REQUEST_ID=T1.REQUEST_ID AND T7.NAME='resource'
    WHERE T1.PROJECT_ID = 0 AND
    ( T1.REQUEST_TYPE = 'Task'
    ) AND
    (T1.ISSOFTDELETED = 0) AND
    (T1.REQUEST_ID <> -1 AND T1.REQUEST_ID IS NOT NULL)

    Regards
    Amruta

  2. #2
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,545
    Provided Answers: 11
    1. db2 level and platform should always be indicated
    2. the question is not very clear : I want to copy c1,c2 into C3 ?
    3. returning error : please provide error
    4. can you explain what needs to be the result more complete
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5-V11 Fundamentals- DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •