Skip to content
Advertisement

MySQL: Extract Select in “Module”

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?

Advertisement

Answer

I found a way to reuse SQL. Its possible via SQL-Functions and SQL-Procedures

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement