Posted: Sun Jan 14, 2007 3:27 pm
REGEXP requires something to match against prior to the keyword appearing. In this case, there is no field or string referenced.
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
SELECT stock_id AS rank FROM curldata WHERE dividend REGEXP '([[:digit:]].[[:digit:]]|.[[:digit:]])' AND 'annsales'>='100' GROUP BY 'stock_id' ORDER BY 'multiplier' ASC, 'multiplier'*'bookval' ASC, 'past_5_earnings' DESC, 'curass'/'long_term_debt' DESC ;Code: Select all
SELECT ticker, stock_id, rank, COUNT( stock_id ) AS rank
FROM curldata
WHERE 'annsales' >= '100'
AND dividend REGEXP '([[:digit:]].[[:digit:]]|.[[:digit:]])'
GROUP BY 'stock_id'
ORDER BY 'multiplier' ASC , 'multiplier' * 'bookval' ASC , 'past_5_earnings' DESC , 'curass' / 'long_term_debt' DESC
LIMIT 0 , 1000;ticker stock_id rank rank
BDF 1 0 1
FCT 2 0 1
FAM 3 0 1
FFA 4 0 1
AGE 10 0 1
Yes it is apart of that whole thing. I decided not to create a score for stocks because I'm trying to create a portfolio model as close as i can that is written in "The Intelligent Investor" (4th ed.) by Ben Graham. He never created a score for stocks so I figured it would be best to not do so myself. However he does have many financial arguments to sort stocks by so i figured I would be able to rank stocks by all the arguments.This is still related to viewtopic.php?t=61291 ?
Why don't you calculate the "ranking points" in getdata_storemysql?
Code: Select all
SELECT * , COUNT( stock_id ) AS rank
FROM curldata
WHERE annsales >= '100'
AND dividend >0
AND multiplier <=17
AND multiplier >0
AND bookval >0
AND multiplier * bookval <= 22.5
AND past_5_earnings >= 16.5
AND curass / long_term_debt >=2
GROUP BY 'stock_id'
ORDER BY 'multiplier' DESC;