Formating the output like this, should be done in your frontend program. It can be done in sql, but it's not gonna be pretty:with employees (location,employee) as ( select 'London','James' union all select 'London','Eddie' union all select 'London','Michelle' union all select 'Madrid','Diego' union all select 'Madrid','Julio' union all select 'Madrid','Marta' union all select 'Berlin','Heinze' union all select 'Berlin','Rudi' union all select 'Berlin','Lothar' ) ,tmp_location (location,rn) as (select location ,(row_number() over (order by location)-1)*3 as rn from employees group by location )select todisplay from (select location as todisplay ,rn from tmp_location union all select b.employee as todisplay ,a.rn+1 as rn from tmp_location as a inner join employees as b on b.location=a.location union all select '' as todisplay ,rn+2 as rn from tmp_location ) as a order by rn ,todisplay
ps.: remove the red section to query your own table.