vendredi 12 juin 2015

sqlite self join with where clause

I have a table that consists of names, points, and years. I need a command to return all the names for a specific year even if the name isn't included in that year. Example

Name        Points    Year
-------    ------- 
tom           8       2011
jim           45      2011
jerry         25      2011
zack         124      2011
jeff          45      2011
tom           62      2012
jim          214      2012
jerry         13      2012
zack          32      2012
arnold         4      2012




Name        Points    Year
-------    ------- 
tom           8       2011
jim           45      2011
jerry         25      2011
zack         124      2011
jeff          45      2011
arnold       NULL     NULL

I figured this would be easy but I am struggling to make it work.

Aucun commentaire:

Enregistrer un commentaire