SELECT and testing condition of a field in the last 2 lines of rows
Hello all.
I'm relatively new to complexe select queries. I could solve the problem in PERL with a heavy solution, I'm looking for a more elegant and fast MYSQL query solution, to improve speed. This script is a perl/mysql stock exchange robot attempt.
If have a table called: hbb_signals with the fields:
id_signal date_in time_in stock_code company_name last_quote last_pattern signal
With the following records in if (for example)
1241 2014-08-18 01:29:07 8296.HK SINO-LIFEGROUP 0.2490 BEARISH HANGING MAN STAY LONG
2487 2014-08-22 20:49:44 8296.HK SINO-LIFEGROUP 0.2450 BULLISH HOMING PIGEON BUY
691 2014-08-18 01:05:54 0992.HK LENOVO GROUP 11.5600 BEARISH ENGULFING STAY LONG
1939 2014-08-22 20:16:45 0992.HK LENOVO GROUP 11.8000 BEARISH MEETING LINE STAY LONG
I would like to do the following.
make a SELECT query and sort the stock code value + signal value, only if today's signal and yesterday's signal have changed. In example upper here, the result would clear LENOVO / 0992.HK stock lines because SIGNAL field has no change in the last 2 days. the result would only display SINO-LIFE GROUP / 8286/HK because SIGNAL field would not be egal yesterday and today.
There should be something like
SELECT (stock_quote, company_name) from dbb_signals where * signal of curdate() <> signal of curdate()-1 DAY *
Who could put me in the right direction with the select Query ?
Subject
Written By
Posted
SELECT and testing condition of a field in the last 2 lines of rows
August 22, 2014 03:32PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.