Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor
Contributor

Working SQL Query giving error when run through Qlik (OLEDB Connect32)

I'm trying to pull in some SAP SQL data through the OLEDB Connect 32 connector, but I'm running into an error when it comes to the Business Partner data table generated through a Left Join containing query. My other tables using the same connector work fine and this Query also works fine when run Microsoft SQL Server Management Studio.

QlikError.JPG

BPMaster:

SQL SELECT OCRD.[GroupCode],

OCRD.[CardCode],

OCRD.[CardName],

OCRD.[SlpCode],

OCRD.[CardType],

OCRG.[GroupCode],

OCRG.[GroupName],

OSLP.[SlpCode],

OSLP.[SlpName]

FROM OCRD

LEFT JOIN OCRG ON OCRD.[GroupCode] = OCRG.[GroupCode]

LEFT JOIN OSLP ON OCRD.[SlpCode] = OSLP.[SlpCode];

1 Solution

Accepted Solutions
Highlighted

Use a LOAD statement before doing the SELECT and make sure you get every field only once, and also that the field spelling is case sensitive.

Alternatively, run the three selects separately (OCRD, OCRG and OSLP) and verify that the results are expected.

View solution in original post

2 Replies
Highlighted

Use a LOAD statement before doing the SELECT and make sure you get every field only once, and also that the field spelling is case sensitive.

Alternatively, run the three selects separately (OCRD, OCRG and OSLP) and verify that the results are expected.

View solution in original post

Highlighted
Contributor
Contributor

mbaeyens Thanks it was due to GroupCode and SlpCode appearing twice.

BPMaster:

SQL SELECT OCRD.[GroupCode] AS 'GrpCode',

   OCRD.[CardCode],

   OCRD.[CardName],

   OCRD.[SlpCode] AS 'SalespCode',

   OCRD.[CardType],

   OCRG.[GroupCode],

   OCRG.[GroupName],

   OSLP.[SlpCode],

   OSLP.[SlpName],

FROM OCRD

LEFT JOIN OCRG ON OCRD.[GroupCode] = OCRG.[GroupCode]

LEFT JOIN OSLP ON OCRD.[SlpCode] = OSLP.[SlpCode];