Hello Ventuzians!
THE FORUMS ARE CLOSED!

Please join our discord server HERE!! << click me :D

We are shutting our Ventuz Forum, but don't worry, it will all be archived for you to search in if you have a query. From now on, please add all your comments, questions or observations into our Discord Server

Thanks for the great time - see you on discord!!
Dee, Karol, Daniel and the whoooole Product and Support team!

SQL TOP & Variable Issue

Please report bugs in this group. We will maybe populate a list of known bugs with a possibly modified description at a later time.

Moderator: Support

Post Reply
zoidberg
Posts: 10
Joined: 22 Jan 2013, 11:14

SQL TOP & Variable Issue

Post by zoidberg » 29 Jan 2018, 09:15

Hi guys,

I have a small issue with using a SQL script node variable to restrict the amount of selected datasets:
Here is my query:

SELECT AVG(R.ImpactAverage) AS ImpactAverageAll,
AVG(R.EconomicalAverage) AS EconomicalAverageAll,
AVG(R.CulturalAverage) AS CulturalAverageAll,
AVG(R.SocialAverage) AS SocialAverageAll,
AVG(R.GeopoliticalAverage) As GeopoliticalAverageAll,
COUNT(R.SessionId) As SessionsPlayed
FROM ( SELECT TOP @MaxHits
ImpactAverage,
EconomicalAverage,
CulturalAverage,
SocialAverage,
GeopoliticalAverage,
SessionId,
CreationTime
FROM Sessions
ORDER BY CreationTime DESC ) AS R


In variable @MaxHits I provide the number of dataset I wanna have for my average calculations. So if I use this variable I get an SQL error message inside of Ventuz that there is a syntax error near my @MaxHits variable. If i replace the variable with a number like 1000 the query is executed without any problems and I get my results.

Any ideas why this error occurs?

Thanks,
Anton

Post Reply