> However I have another problem which I need your ideas.
It's better to create a new thread when you want to discuss a new
> I have a table where prices for a few stock tickers are inserted. I have
> another temp table which holds the prices for the max trade date. I have a
> trigger which updates the temp table when there is a an insert into the
> prices table. This makes sure that I have the latest data for all the
> tickers in the temp table.
> Now I have a column called pricechange. I would like to calculate the
> difference between pevious close price and today's close price in that
> column. So theoretically speaking after the insert of new prices in the
> prices table and I would like a trigger that will update the pricechange
> with the price difference.
> But I am unable to do it.
> DBD::mysql::st execute failed: Can't update table 'tbl_prices' in stored
> n/trigger because it is already used by statement which invoked this
Welcome to MySQLs half-assed trigger implementation ;-)
Can you do this from the first trigger that updates the temp table (inserts
the items?) instead?
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Database development questions? Check the forum!