Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Use SQL table fields multiple times

Hi,

Im a novice use of Qlikview (personal edition - desktop)

I have made a connection to my MSSQL server and database

In my database I have a table called Persons

ID - NAME - MASTER_ID

1     A               0

2     B               0

3     C               1

4     D               2

5     E               3

In my Qlickview project I a have made a selection list

My problem is that I only want to see the rows where MASTER_ID = 0

This is my importscript:

Bedrijfsleiders:

SQL

SELECT *

FROM "DW_MTC".dbo.Personeel WHERE baas_id = 0;

Uitvoerders:

SQL

SELECT *

FROM "DW_MTC".dbo.Personeel WHERE baas_id != 0;

Export of the importscript

Connecting to DW_MTC

Connected

Bedrijfsleiders << Personeel 2 regels opgehaald

Bedrijfsleiders << Personeel 7 regels opgehaald

........

I have tried diffrent things but a can't find a solutions. When I start the importscript like below I only see "Bedrijfsleiders"

3 Replies
Gysbert_Wassenaar

WHERE baas_id != 0 may not work. Usually it's written as l WHERE baas_id <> 0;

Also, if you load exactly the same fields then the data ends up in the first table. If you don't want that you can specify the noconcatenate keyword:

Uitvoerders:

noconcatenate load ...etc

But you'll get a massive syntethic key.

You can rename the fields or use the qualify keyword:

qualify *;

Uitvoerders:

load ...etc

That's also not a good idea. The best plan is to load the Persons table as it is with both the bedrijfsleiders and uitvoerders. You can use the baas_id field in expressions to distinguish between them.

There's also the possibility to create a hierarchy table using the hierarchy keyword. Look at this discussion for an example.




talk is cheap, supply exceeds demand
Not applicable
Author

@Gysbert Wassenaar: Can you show me a example of a expression to distinguish and to show only the field where MASTER_ID = 0

Not applicable
Author

If you only want to see the rows where MASTER_ID = 0 from Persons table, then simply try this code.

Load *

where  MASTER_ID = 0;

SQL

SELECT *

FROM  Persons;