I've been researching about MySQL statements and similar issues for some thime now and I don't seem to be having any luck.
Can I create a variable that would store a 1 column data result to be used in multiple queries? Would it be efficient to do so or am I confused about how a DB differs from a PL?
I was thinking something like the following pseudo code
SET list = Select ID from Sales;
Update items set aValue = X where salesID in list
delete SalesMessages where salesId in list
I've got about 8 updates to do in a Store Procedure I could do the select for every case instead of creating a variable, but I doesn't feel like the best approach. Any help?
JOINor Derived Tables instead, for merging theselectquery withupdateanddeletequery.WHERE salesID IN (SELECT * FROM tempSalesList)or similar usingEXISTSor aJOIN, etc, etc. (Note, if your list really is being populated withSELECT * FROM sales, just use the sales table. Copying every one of those values elsewhere is never going to help in any way. If you need a costly sub-set of that table though, storing them in a TempTable is fine.)