Postgresql Query

relate two database table in bonita

Bonita by default saves data in its configured database. I want to relate two tables and want to get values. I want to relate arch_data_instance and arch_flownode_instance and want to get values of specific form like i want to get data from arch_data_instance table of publish node with complete status completed. In other words i want to get data when whole process finishes.