I have SELECT with UNION and LIKE in my project and I have this code:SELECT TOP 10 pcchrgcodFROM ( SELECT TOP 10 acctno AS pcchrgcod FROM hdocordWHERE acctno LIKE '2007-000%' GROUP BY acctnoUNIONSELECT TOP 10 acctno AS pcchrgcod FROM hpatchrgWHERE acctno LIKE '2007-000%' GROUP BY acctno UNIONSELECT TOP 10 acctno AS pcchrgcod FROM hrqdWHERE acctno LIKE '2007-000%' GROUP BY acctnoUNIONSELECT TOP 10 acctno AS pcchrgcod FROM hrxoWHERE acctno LIKE '2007-000%'   GROUP BY acctno )sub GROUP BY pcchrgcodWhen I run this code in MSSQL IDE I get:The query result is too slow.So when I try in a browser I get:Fatal error:  Maximum execution time of 30 seconds exceeded in Is there another way to improve the SELECT query to make it return the result faster in a web browser?
Fasten select JOINs and SELECT UNION to get results faster
sql;sql server