Unfortunately, there is a problem with this query.
Column "user" in "portalsession" contains:
- IP addresses (if users are guests who are not logged in)
and
- User IDs if users are logged in.
If user ID in "usertable" is, for example, "194", this query will select from "portalsession.user" all IP addresses that start with "194.XXX.XXX.XXX"
I tried to fix the problem by replacing:
left join portalsession on profileviewers.visitor_id = portalsession.user
with:
left join portalsession on profileviewers.visitor_id = CAST(portalsession.user AS CHAR)
but it doesn't help.
Any ideas how to resolve this problem?
Thanks.