Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

pzwonford
New Contributor II

Import data from two tables

Hi guys. I have the following tables in an Access database:

Customer

CustomerID

Name

Active?

123

Bob smith

Yes

444

John Jones

Yes

990

Ed Johnson

No

087

Paul Crisp

Yes

Address

CustomerID

Address

123

1 Shakespeare Road, Bedford.

444

5 Dudley Street, Bedford

990

9 Holly View, Sowerby Bridge

087

18 Church Lane, Ravensden

I would like to import only customers who are active. The problem with this is that if I tell the code to import only active from the customer table, it still imports the inactive information (customer 990) from the address table. Can anyone suggest anything?

My basic code is as follows:


ODBC CONNECT32 TO [MS Access Database;DBQ=C:\Users\u22471\Desktop\QV\New Microsoft Access Database.accdb];
SQL Select *

FROM [Customer];
ODBC CONNECT32 TO [MS Access Database;DBQ=C:\Users\u22471\Desktop\QV\New Microsoft Access Database.accdb];
SQL Select *

FROM [Address];

1 Solution

Accepted Solutions

Re: Import data from two tables

ODBC CONNECT32 TO [MS Access Database;DBQ=C:\Users\u22471\Desktop\QV\New Microsoft Access Database.accdb];
SQL Select *

FROM [Customer];
ODBC CONNECT32 TO [MS Access Database;DBQ=C:\Users\u22471\Desktop\QV\New Microsoft Access Database.accdb];

load *

where exists ( CustomerID ) ;

SQL Select *

FROM [Address];

9 Replies

Re: Import data from two tables

ODBC CONNECT32 TO [MS Access Database;DBQ=C:\Users\u22471\Desktop\QV\New Microsoft Access Database.accdb];
SQL Select *

FROM [Customer];
ODBC CONNECT32 TO [MS Access Database;DBQ=C:\Users\u22471\Desktop\QV\New Microsoft Access Database.accdb];

load *

where exists ( CustomerID ) ;

SQL Select *

FROM [Address];

salto
Valued Contributor II

Re: Import data from two tables

Hi,

     Isn't it possible to add a where clause similar to:

         Active='Yes'

     And check the result?

pzwonford
New Contributor II

Re: Import data from two tables

When i try this i get

SQL##f - SqlState: 07001, ErrorCode: 4294964286, ErrorMsg: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
SQL Select *

FROM [Customer]
Where [Active] = 'Yes'

Not applicable

Re: Import data from two tables

Hi,

Here both ODBC connections are same so no need to write connection string two times

ODBC CONNECT32 TO [MS Access Database;DBQ=C:\Users\u22471\Desktop\QV\New Microsoft Access Database.accdb];
Customers:

SQL Select *

FROM [Customer] where Active<>'No';

inner join(Customers)

Address:
SQL Select *
FROM [Address];

san_qliklearn
New Contributor II

Re: Import data from two tables

Use :

where condition for Active column.

where Active ='Yes'

salto
Valued Contributor II

Re: Import data from two tables

Maybe:

SQL Select *

FROM [Customer]
Where [Active?] <> 'No'

pzwonford
New Contributor II

Re: Import data from two tables

When i run this code i get

SQL##f - SqlState: 07001, ErrorCode: 4294964286, ErrorMsg: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
Customers:

SQL Select *

FROM [Customer] where Active<>'No'

salto
Valued Contributor II

Re: Import data from two tables

Is the field name correct [Active?]

pzwonford
New Contributor II

Re: Import data from two tables


Sorry, i changed it to [Active] because i was worried the question mark was causing the issue which it wasnt

Community Browser