select ShareAm.date,SharePm.code,ShareAm.opening,SharePm.open,100*(SharePm.open - ShareAm.opening)/ShareAm.opening as L
from SharePm,QQ,ShareAm
where ShareAm.date = QQ.date and
SharePm.code = QQ.code and
ShareAm.code = SharePm.code and
date(ShareAm.date,'+1 day') = SharePm.date
order by SharePm.date asc