I am trying to combine two tables, S&P2 and Foundation, so that I can transfer information from corresponding rows in S&P2.Tic into Foundation.Ticker.
I created this code; however, no matter how I alter the code SQL always returns the Error Code 1054: Unknown Column/Field. This field is always S&P2. If this error does not pop up, SQL will just continually run.
USE nasdaqProj;
SELECT `S&P2`.`fyear`
FROM `nasdaqProj`.`S&P2`;
select * from Foundation;
SELECT `S&P2`.`conm` As sconm, `S&P2`.`tic` as 'ticker'
from nasdaqProj.`S&P2`
left outer join Foundation
ON `S&P2`.conm LIKE CONCAT (Foundation.comnm,'%')
and `S&P2`.fyear = Foundation.year
UNION
SELECT `S&P2`.`conm` As sconm, `S&P2`.`tic` as ticker
from nasdaqProj.`S&P2`
right outer join Foundation
ON `S&P2`.conm LIKE CONCAT (Foundation.comnm,'%')
and `S&P2`.fyear = Foundation.year;
I have been stuck on this for a while, and after reading the other error code 1054 question answers I was still unable to apply the solutions to my code.