select distinct tbl2.id, tbl1.year
from table1 tbl1 join table2 tbl2
on(tbl1.tbl2id = tbl2.id)
here's the output of this query
ID YEAR
1 2001
1 2002
2 1995
2 1996
but the output that I want is something like this
1 - 2001, 2002
2 - 1995, 1996