Assuming the following SQL statement:
SELECT pm.id FROM r2r.partmaster pm WHERE pm.id NOT IN (SELECT pd.part_num FROM wpsapi4.product_details pd)
The there a way to modularize the statement, for instance, extract the second select statement in a file and call this file instead of writing the whole query?
I found a way to reuse SQL. Its possible via SQL-Functions and SQL-Procedures