Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everybody.
I have a table with different entries. First of all, there is a column "id". Now I want to save the data in a .qvd file and add only new data. By concatenate. To identify the new data I would like to do something like: let "vMaxID = max (id);". But this only returns NULL and not the largest previous id. How can I do that?
Thank you for your help.
Max(id) has no meaning in this context -- that's why you get a null.
You need to use the script to generate a max and then Peek that into the variable. Like this:
T_Max:
LOAD Max(id) as Maxid
Resident ....
Let vMaxID = Peek('Maxid');
DROP Table T_Max:
Max(id) has no meaning in this context -- that's why you get a null.
You need to use the script to generate a max and then Peek that into the variable. Like this:
T_Max:
LOAD Max(id) as Maxid
Resident ....
Let vMaxID = Peek('Maxid');
DROP Table T_Max:
Many thanks. This knowledge will significantly speed up my loading script.
Is '$(vMaxID)' the correct way to use the variable in sql select?
If it is numeric, then you will not need the quotes
SQL
...
Where id = $(vMaxID);
If its is text, then
SQL
...
Where id = '$(vMaxID)';