Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

How to use Hive update with select statement to SET a column Value

avatar
New Contributor

Can anyone tell me what's wrong in this query ?

UPDATE tableA SET submitted_from_ip=(SELECT vqs.fieldvalue FROM viewA vqs join tableA fqs on vqs.formid=fqs.formid AND vqs.SubmitTime=fqs.submit_time WHERE vqs.fieldname='submitted_from_ip') JOIN tableA fqs on vqs.formid=fqs.formid AND vqs.SubmitTime=fqs.submit_time WHERE vqs.fieldname='submitted_from_ip';

3 REPLIES 3

avatar
Master Guru
@Ahmar Khan

Update <table_name> Set <col_name>=(<Query>) is not possible with Hive.

Update <table_name> Set <col_name>="<value>" is possible with Hive.

You could try using Hive ACID Merge approach to update the values But not sure is merge will work with setting out values based on the query.

avatar
Master Guru
@Oliver Queen

Glad to hear that.. 🙂

Could you Click on Accept button below to accept the answer to close the thread as accepted, That would be great help to Community users to find solution quickly for these kind of issues.

avatar
New Contributor

Thank you @Shu
Hive Merge approach worked for my case.