I’ve been trying to assemble a stored procedure on my Azure database that when it runs the query, it returns one output value from one specific column.
The likelihood of multiple results is zero since the the table being queried has 3 columns, and the query must mach 2. Then it grabs data from another table. The key is I need the first query to output the value in order to commence the second query.
At present I have 2 procedures, I would like to have one.
Query is as such for the moment:
select
customers_catalogs_define.catalog_id
from
customers_catalogs
left outer join
customers_catalogs_define on customers_catalogs.catalog_id = customers_catalogs_define.catalog_id
where
customers_catalogs.catalog_unique_identifier = @catalog_unique
AND customers_catalogs_define.customer_id = @customer_id
The output of course is the catalog_id. From that I take it into another query which I have that does the actual list retrieval. At the very least I would like to add a line that simply states @catalog_id = output
Thanks
You have two options basically to have this work :
Since I haven’t seen your second query, just make sure its querying the correct table listed below as
CUSTOMERS_CATALOGS_DEFINEUsing a variable as you suggested:
Second option would be to do it in one query: