hi, table A: id,column_name1, column_name2,column_name3 1,03OP20111684,, 2,01OP20111607,30, 3,01OP20111649,90,0020018393 4,01OP20111688,40,0020013010
table B ,: id,column_name1, column_name2,column_name3 1,,10, 2,,40, 3,01OP20111638,,0020029804 For example: the first and second records only update column [column_name2], and the third record updates columns [column_name1,column_name3]. so ,I expect the updated result: table A: id,column_name1, column_name2,column_name3 1,03OP20111684,10, 2,01OP20111607,40, 3,01OP20111649,90,0020018393 4,01OP20111688,40,0020013010 Help me how to write the SQL for update ? Thanks. ________________________________ neusoft TSD 刘feng From: akashrn5<mailto:akashr...@gmail.com> Date: 2020-10-09 12:56 To: dev@carbondata.apache.org<mailto:dev@carbondata.apache.org> Subject: Re: How to update based on the value of the source table Hi, I checked our test cases, we have a similar test case and works fine. You can refer "update carbon table[select from source table with where and exist]" in UpdateCarbonTableTestCase.scala, In that test case, you can have a query like below *sql("""update iud.dest11 d set (d.c3, d.c5 ) = (select s.c33,s.c55 from iud.source2 s where d.c1 = s.c11)""").show()* It works fine. I didn't get the actual question, where you said *when B.column_name1 == '' , no update operation is performed. when B.column_name1 !='', update operation is performed.* can you please tell me what value are you trying to update? If you can give the complete test case, it will be useful to check. Also, please join the slack channel for detailed discussion. https://join.slack.com/t/carbondataworkspace/shared_invite/zt-g8sv1g92-pr3GTvjrW5H9DVvNl6H2dg Thanks, Regards, Akash R Nilugal -- Sent from: http://apache-carbondata-dev-mailing-list-archive.1130556.n5.nabble.com/ --------------------------------------------------------------------------------------------------- Confidentiality Notice: The information contained in this e-mail and any accompanying attachment(s) is intended only for the use of the intended recipient and may be confidential and/or privileged of Neusoft Corporation, its subsidiaries and/or its affiliates. If any reader of this communication is not the intended recipient,unauthorized use,forwarding, printing, storing, disclosure or copying is strictly prohibited, and may be unlawful.If you have received this communication in error,please immediately notify the sender by return e-mail, and delete the original message and all copies from your system. Thank you. ---------------------------------------------------------------------------------------------------