Ganapat Ganapat - 1 year ago 112
SQL Question

OrientDB: How to update column using select query

I need to update a column in table using following:

update Table1 set name = (select productName from Table2 where

Query works fine but instead of name query stores value in "[productname]" format.

I have read orientdb documentation, I guess select query returns result in collection format. so I have already tried following functions

  • get(1)

  • first()

  • [0] etc (my desperate attempt :)

Thanks in advance.

Answer Source

I tried searching but did not get any clean ans, but i making following change worked for me & got the job done :)

update Table1 set name=(select productname from Table2 where
name= name.replace("\[","").replace("\]","")

Hope this saves time for someone.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download