lundi 11 juillet 2016

Join in SQL using R

I have 2 tables one is Medals and one is athletes I am trying to get a new table with the fields year and athelte_id from medals but only if it was a woman marathon and silver.I need it with the second table athletes.both tables have the field athlete_id

my code is

dbGetQuery(con2,statement ='SELECT  year,athlete_id FROM Medals 
WHERE event="Marathon Women" AND medal="SILVER"
JOIN Athletes ON  Medals.athlete_id=Athletes.athlete_id')

I get an error:

Error in sqliteSendQuery(con, statement, bind.data) :
error in statement: near "JOIN": syntax error

any ideas how to fix this?

Aucun commentaire:

Enregistrer un commentaire