So once again lets focus on my second part of my sql statement variable, I have slightly modified it.
Code: Select all
$mysql_tickname_insert .="UPDATE curldata SET rank=ASC_ORDER WHERE dividend = ([[]].[[]]|.[[]]), multiplier <= 17, multiplier*bookval<=25.5, past_5_earnings>=16.5, annsales>=100, curass/long_term_debt >= 2;";
My goal is to have a sql statement that ranks a stock in this order. I'll do my best to elaborate:
-----------------------------------------Determinants for types of stocks I want to rank------------------------------
Stock must have a dividend:
-I figure if I just put in a regular expression, it will select stocks with dividends with prices (i.e. (1.20 | .25)). Also does the REGEX tutorial found on this forum apply to MYSQL regex or not?
Code: Select all
([[:digit:]].[[:digit:]]|.[[:digit:]])
Annsales (annual sales) greater than or equal to (>=) 100:
- Annual sales should be greater than 100; does not impact a stock's rank whether it is higher or lower. This is just another determinant of what stocks I want just like the dividend test.
------------------------------------------Evaluations to rank stocks-----------------------------------------------------------
Multiplier must be less than or equal to (<=) 17:
-hence the section of my sql statement contains:
The lower the multiplier, the higher the rank will be for that particular stock.
Multiplier times bookval should be less than or equal (<=) to 25.5:
- I multiply the multiplier and bookval column together for each stock and test to see if it is less than or equal to 25.5; the lower the number of this value, the better:
Past_5_earnings must be greater than or equal to (>=) 16.5:
- The earnings of the stock over the past 5 years must be greater than or equal to 16.5 or better; the higher the growth number the better the rank.
Curass (current assets) divided by long_term_debt greater than or equal to (>=) two:
-the current assets divided by long_term_debt should be a ratio greater than or equal to two; the greater the number the better the rank.
NOTE: I'm not asking for people to just give me the code, I want to be able to do this myself; the trouble is that I simply do not now how to say this in sql.