Hello everyone. I'm trying to wrap my head around the concept of prepared statements and how to write them. Any assistance is much appreciated.
Let's say that I want to inner join a table on a common column name and I want that first query to return column names only. then I want to run a query on that first query that looks for any blank values on those previous rows returned and I want that second query to return those rows that have a blank value.
It's basically looking for blank values in matching rows returned without having to write those column names. Here's my attempt.
SET @sql_select1 = 'SELECT * from information.schema.schemata
INNER JOIN orders ON `order`.CustomerID = `customers`.CustomerID'
SET @sql_select1 = CONCAT(@sql_select1, 'where schema_name = ""')
PREPARE stmt from @sql_select1
DEALLOCATE PREPARE stmt
I really need some help to understand how to do this. Thanks