If there are different names in Table 'Y' against a single code then this will would not work
select distinct x.id,x.code,y.name from X left outer join Y on x.code=y.code
you will have to change it something like this to get 100 rows each time:
select x.code,MAX(y.name) as name
from X
left outer join Y on x.code=y.code
Group by x.code
If you are certern that name would not be changed in Table 'Y' which i doubt then you the Query1 else use the Query2.
Hope it helps