I have two tables that I'm trying to connect. One table is called 2019projections and the other is called 2019actualstat. I want to connect the two by names. I'm 99% sure every name that is in 2019actualstat is in 2019projections, but not every name in 2019actualstat is in 2019projections. The latter has alot more names, but most of them are useless.
- I've tried left join and right join.
- I've tried select distinct
- I gave a shot at exists
This is what I have so far:
USE Fantasyfootball;
SELECT DISTINCT *
FROM 2019actualstat;
LEFT JOIN 2019projections ON
2019actualstat.Player =
2019projections.first_last;
It's giving me the 1064 error, but I think it has to do with the 2019projections table having more records.
21:27:26 LEFT JOIN 2019projections ON 2019actualstat.Player = 2019projections.first_last Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LEFT JOIN 2019projections ON 2019actualstat.Player = 2019projections.first_last' at line 1 0.00071 sec
2019projections.first_last
is a varchar(50)
and 2019actualstat.player
is text
PS: I have the .csv files which I'm not sure how to post, but I would be happy to send them both.
You're missing the select
list, and have a redundant (wrong) semicolon at the end of the from
clause:
SELECT *
FROM 2019actualstat
LEFT JOIN 2019projections ON 2019actualstat.Player = 2019projections.first_last;