Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
Do anyone know how to use the result of a SQL sentence as the variable's value?
Thanks and best regards,
CoCo
Hi CoCo,
For this one, I would suggest you load all data from Account table. Like this
[Age]:
SQL Select [Account ID],[Account Name], [Age] From Account;
Create new variable in "Variable Overview" by click Add:
1. Variable name: vAge2635
2. Definition: Count({$<[Age]={'26-35'}>} [Account ID])
Regards,
Sokkorn
Hi CoCo,
What is your SQL sentence?
Regards,
Sokkorn
Or Something like this
LET Query = 'SELECT * FROM TableName';
[TableName]:
LOAD *;
SQL $(Query);
CoCo,
1) Put the result into a temp table
2) use the peek function to store the result into a local variable
let MyVar = peek('FieldName', Integer Number, 'Table name')
The number starts at 0 (1st line) and ends at NoOfRows('Table')-1
Fabrice
Hi Scokkorn,
In the qlikview, is the SQL grammar same with standard SQL sentences?
Hi Fabrice,
Yes, CoCo
SQL Select Field1, Field2 From TableName Where Field1='Value';
Regards,
Sokkorn
Hi Sokkorn,
Actually, I want to creat the variable, using the result of a SQL sentence, in the "Variable Overiew" window.
So how should I do ? Could you please provide a sample for me?
Thanks too much.
Hi CoCo,
Can you prepare your SQL statement with result set? And manipulate your variable for output?
Regards,
Sokkorn
Oh, great!
But when I use the same sentence in the "Variable Overiew" window, it occurs the grammar errors.
I don't know why!
FYI: