Scusate ma non c'è un metodo + semplice ed elegante per ottenere questo risultato:
select top 2 city, name, description from tabella where city = 'roma'
union all
select top 2 city, name, description from tabella where city = 'milano'
union all
select top 2 city, name, description from tabella where city = 'venezia'
union all
select top 2 city, name, description from tabella where city = 'bologna'
union all
select top 2 city, name, description from tabella where city = 'napoli'
union all
select top 2 city, name, description from tabella where city = 'amsterdam'
union all
select top 2 city, name, description from tabella where city = 'vienna'
union all
select top 2 city, name, description from tabella where city = 'lisbona'
union all
select top 2 city, name, description from tabella where city = 'madrid'
union all
select top 2 city, name, description from tabella where city = 'pisa'
il tempo di esecuzione non è neanche troppo alto ma magari si puo fare di meglio!
![]()

Rispondi quotando