ExecuteSQL calculation not filtered per customer in portal
I've a lovely SQL calculation on a portal which simply shows a Select Max from a list of values.
However, on customer AAA it's showing the Max value from the entire table, which happens to be customer BBB.
Does ExecuteSQL somehow circumvent the normal behaviour of portals which is to keep their results specific to the related record upon which they reside?
Just for kicks, I tried inserting a where FKID=PKID within the SQL statement but this resulted in a '?'
I suggest posting the actual calculation so that we can see it. And is the Customer ID a field in the portal's table, the layout's table or some other related table? (Like any calculation, context can make a difference here.)