> > > I have a STOCKTRANSACTION table
Ah, this is commonly called a "derived table".
You might want to create a select-able stored procedure and pass
the "transtype" and "stockcode" to it.
You will get something like:
LEFT JOIN MYPROCEDURE(0, 'AIRSUS01') M ON A.PERIOD = M.PERIOD
And do the query inside your procedure.
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL