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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

SQL script!

$(QVDatabaseTable_1):

LOAD * ;

SQL SELECT count(*) as NoOf_Rows

 

FROM $(DatabaseName).$(DatabaseUser).$(DatabaseTable_1)

$(INCREMENTAL_EXP);

Store $(QVDatabaseTable_1) into $(vQVDFileName_1)(qvd);

Drop Table $(QVDatabaseTable_1);

This just will not run... do anybody have an idea?

i have also tried just

SQL SELECT count(*)

also.


please let me know if I am doing anything wrong.


Thank you!!

Labels (1)
8 Replies
robert_mika
MVP
MVP

With aggregation, you need to use Group by the statement.

Something like:

SELECT somecolumn,someothercolumn, COUNT(*)
  
FROM my_table
GROUP BY somecolumn,someothercolumn






www.qliksteps.com

jagan
Partner - Champion III
Partner - Champion III

Hi,

Check whether your variables are populating with expected values.

Regards,

Jagan.

Anonymous
Not applicable
Author

^^ I agree, Variables are most probably the issue. the rest look fine imo.

maxgro
MVP
MVP

You can add some TRACE before the LOAD statement, something like

TRACE  QVDatabaseTable_1=$(QVDatabaseTable_1);

TRACE DatabaseName=$(DatabaseName);

.....

to check you vars

Also you can post the error you get

asgardd2
Creator III
Creator III

Are your problem with sql query? (SELECT count(*) as NoOf_Rows ... )

Please, post error,which you get, when document is reloading.

Not applicable
Author

OUTER JOIN worked perfectly for me!! I have a followup question.

is it possible to make another column by adding or subtracting other two columns?

for example, let's say by Outer Joining I got three columns col1, col2, col3

Can I make col4 by col1 - col2?

Anonymous
Not applicable
Author

Yes, you can do that in the preceeding load

Table1:

Load

*,

col1 - col2 as col4;

sql....;

maxgro
MVP
MVP

if you have a table (Table) with a logical primary key (Id) with a join

left join (Table)

load

    Id,

    col1 - col2 as col4

resident Table;

or you can always do a resident load

NewTable:

Noconcatenate    

Load

    *,

    col1 - col2 as col4

resident Table;

drop table Table;