Howdy! I apologize in advance for the ugly query I'm about to throw your way....

I need to delete some data from a table based on a multi-column join. Is there a better way to write this?

delete
from tbldata
where unitID || '_' || variableID || '_' || cycleID in
(select unitID || '_' || variableID || '_' || cycleID from temp_data_table)


In SQL Server I would just write

delete tblData
from tblData a
        inner join temp_data_table b
                on a.unitID = b.unitID
                        and a.variableID = b.variableID
                        and a.cycleID = b.cycleID

but that doesn't seem to be supported in postgres...


Thanks in advance for you help!

Leon

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Reply via email to