I forgot a trick a teacher told me that allowed a Select query to be your table (assuming only parts of the database is used with repeating entries)...
THIS_FUNCTION(Select link, things, conditions from OneTable tabA where conditions = IGotSomething)
THIS_FUNCTION(Select link, things, conditions from OneTable tabB where conditions = IlostSomething)
Select tabA.things - tabB.things from tabA inner join tabB on tabA.link = tabB.link
Something like that.
Someone help me remember?
In case anyone is asking... My database uses one table for all transactions that come in and out, defined by a column where stuff is going. To get an inventory of everything, I need to see where stuff came from (-stock) and where stuff is going to (+stock).
There WILL be cases that where it's going to is ALSO where it came from.
I already have an idea how to do this, but I need that trick I forgot...
Whoops! I forgot to mention I need to be able to build these queries based on user needs during runtime. It's something customizable, thus building and rebuilding views may take up more processes than wanted.