|
-
No,it doesn´t work.
In my select ,I return 3 fields:
1-first one must be first 5 registers from descripcion as provincia
2-count(provincia) as numero
3-(Select count(provincia) from empresas where provincia not in
(select * from(Select provincia from empresas group by provincia order by count(provincia) desc)where rownum <=5)) as resto
the 3rd one must be this way,because I have tried it,and that's what I nedd it to return.
The problem is,I'm translating it from SQL Server,and there must be something wrong related to so many groups by,order by or something...
Here is the original select in SQL Server:
select top 5 descripcion as Provincia,count(provincia) as numero,
(Select count(provincia) from empresas where provincia not in
(Select top 5 provincia from empresas group by provincia order by count(provincia) desc)) as resto
from empresas inner join provincias on empresas.provincia=provincias.codigo
group by provincia,descripcion order by count(provincia) desc;
If I try it without the 3rd field,it works.And if I try the selects of the 3rd field alone,it works too.The problem is when I join them....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|