Hi
I'm trying to select distinct top 10 url, it's count(url) and size from log_table joining other tables too.
I tried the following SQL Server query:
select distinct top 10
url, count(url) as hits,
size as data
from log_table
where log_table.IP in
(select IPAddress from IP where IP.IPId in
(select IPId from userIP where userIP.userId in
(select userId from Users)))
group by url, size
order by hits desc
It doesn't give me distinct url. But when I try the following query without size, it gives distinct url and hits.
select distinct top 10
url, count(url) as hits
from log_table
where log_table.IP in
(select IPAddress from IP where IP.IPId in
(select IPId from userIP where userIP.userId in
(select userId from Users)))
group by url
order by hits desc
What do I need to do for selecting distinct url, it's hits and size used. url, size are from log_table table.
Any help is appreciated.
Thank you.