Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Add values to sql query

Helo guys,

So I have this SQL query that regurts a set of number (1,2,3,4,5,6....,1999,2000,2001) .

I would like to add to these results 3 more values, for example, if I have 1,2,3,4,5,6....,1999,2000,2001 and I add the values I would get 1,2,3,4,5,6....,1999,2000,2001,2002,2003,2004.

How can I achieve this?

Thank you in advance!!

Best regards.

16 Replies
Not applicable
Author

Hello Márcio,

in attachment there is a dummy qvw file. I had to remove the sql query because it would not work for you and I simulate this with a excel file where I load the values from.

I have QV personal edition so I won't be able to open a file edited with another version

Thank you in advance.

Best regards.

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this

QV_Table:

Sql Select Sequence,Number,Time From Table;

MaxValue:

LOAD

Max(Sequence) AS MaxSequence

RESIDENT QV_Table;

LET vMaxSequence = Peek('MaxSequence');

DROP TABLE MaxValue;

Concatenate(QV_Table)

LOAD

  $(vMaxSequence) + RecNo() AS Sequence

Autogenerate(3);

Hope this helps you.

Regards,

Jagan.

Not applicable
Author

Ok I finally understood how to use the example you guys provided, but is does not solve the problem, I still do not have the  extra 3 values.

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try this sample script

QV_Table:

LOAD

*

INLINE

[

Sequence, Dim

100,abc

101,def

102,ghi ];

MaxValue:

LOAD

Max(Sequence) AS MaxSequence

RESIDENT QV_Table;

LET vMaxSequence = Peek('MaxSequence');

DROP TABLE MaxValue;

Concatenate(QV_Table)

LOAD

  $(vMaxSequence) + RecNo() AS Sequence

Autogenerate(3);

I am getting additional records with 103, 104 and 105.

Regards,

Jagan.

Not applicable
Author

Hi Jagan,

So your solution worked well and I can add my extra three values to the query, but now I am wondering, what if I want to do someting like this (the N/A values forced):

jagan
Partner - Champion III
Partner - Champion III

Try this script

Concatenate(QV_Table)

LOAD

  $(vMaxSequence) + RecNo() AS Sequence,

'N/A' AS Knr,

'N/A' AS time

Autogenerate(3);

Regards,

Jagan.

Not applicable
Author

Thank you Jagan, it works well enough