Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Support Cases coming to Qlik Community Oct. 4! Start chats, open cases, explore resources: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

SQL SELECT SYNTAX

Good day,

I have a simple question with probably a simple solution but I keep getting the following script and  error:

/QTQVC/OPEN_STREAM failed after 00:00:00 Key = SQL_ERROR (ID:00 Type:E Number:001 "," is invalid here (due to grammar). contains an invalid character or it is a keyword. (It might be possible to escape it using "!"). Or a space is missing or there is one space too many.)

SQL Select

LIFNR,

GJAHR,

MONAT,

BLART,

SUM(DMBTR) AS [AMOUNT]

FROM

BSAK

WHERE GJAHR = '2018' AND (BLART = 'RE' OR BLART = 'KR')

GROUP BY LIFNR, GJAHR, MONAT, BLART;

Please assist as I cannot find the problem

Kind regards

13 Replies
prma7799
Master III
Master III

Query which you write looks ok just check spelling for fields ..

prma7799
Master III
Master III

Or try to load simple table as below

SQL Select

*

FROM

BSAK ;

Not applicable
Author

Thanks for the reply P M. I think I may have not been clear with my initial query. I get a script error but I do not know why, everything looks fine.

I do not want to select all records since this is a massive SAP table

Script is:

Load *

;

SQL Select

LIFNR,

GJAHR,

MONAT,

BLART,

SUM(DMBTR) AS [AMOUNT]

FROM

BSAK

WHERE GJAHR = '2018' AND (BLART = 'RE' OR BLART = 'KR')

GROUP BY LIFNR, GJAHR, MONAT, BLART;

Regards

avinashelite

Did you tried your SQL query in DB once ? try to run the query once in DB and check

SQL Select

LIFNR,

GJAHR,

MONAT,

BLART,

SUM(DMBTR) AS [AMOUNT]

FROM

BSAK

WHERE GJAHR = '2018' AND (BLART = 'RE' OR BLART = 'KR')

GROUP BY LIFNR, GJAHR, MONAT, BLART

prma7799
Master III
Master III

Can you please share script error

Not applicable
Author


/QTQVC/OPEN_STREAM failed after 00:00:00 Key = SQL_ERROR (ID:00 Type:E Number:001 "," is invalid here (due to grammar). contains an invalid character or it is a keyword. (It might be possible to escape it using "!"). Or a space is missing or there is one space too many.)

QVe.png

Kushal_Chawda

try this

SQL Select

LIFNR,

GJAHR,

MONAT,

BLART,

SUM(DMBTR) AS [AMOUNT]

FROM

BSAK

WHERE GJAHR = '2018' AND BLART in('RE' , 'KR')

GROUP BY LIFNR, GJAHR, MONAT, BLART;

Not applicable
Author

Thank ypu for the reply Kushal, unfortunately this does  not work. I commented out the where clause and i still get the same error. With the where clause I get this error:

/QTQVC/OPEN_STREAM failed after 00:00:00 Key = SQL_ERROR (ID:00 Type:E Number:001 "IN(" is invalid here (due to grammar). contains an invalid character or it is a keyword. (It might be possible to escape it using "!"). Or a space is missing or there is one space too many.)

SQL Select

LIFNR,

GJAHR,

MONAT,

BLART,

SUM(DMBTR) AS [AMOUNT]

FROM

BSAK

WHERE GJAHR = '2018' AND BLART in('RE' , 'KR')

GROUP BY LIFNR, GJAHR, MONAT, BLART

prma7799
Master III
Master III

Please check format for this

GJAHR = '2018'

BLART = 'RE'

BLART = 'KR'