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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

SQL error

Hi, what's wrong in this script?

[EBAN_W]:

ADD

LOAD *

;

  SQL

    SELECT DISTINCT MATNR, TXZ01

    FROM EBAN

    WHERE Right(MATNR,1) = '4'

  ;

But this scrpt works:

[EBAN_W]:

ADD

LOAD *

;

  SQL

    SELECT DISTINCT MATNR, TXZ01

    FROM EBAN

    WHERE MATNR = '4000000'

  ;

Thanks

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Javier

The reply by Lukasz is absolutely correct.

For SQL on Oracle [other brands of SQL may vary] you would need :

   SELECT DISTINCT MATNR, TXZ01

    FROM EBAN

    WHERE MATNR like '%4'  ;

Assuming I have understood correctly and need the last character to be 4.

Best Regards,     Bill

View solution in original post

7 Replies
Not applicable
Author

Hi Javier

You can't use QlikView functions in WHERE clause of SQL query. This query is send to database thus only DBMS functions are supported.

Lukasz

Not applicable
Author

Hi,

I have this too, because our version of SQL doesn't deal with Right( function, only with substr.

Right(MATNR,1) is then translated into Substr(MATNR,Length(MATNR),1). This is in Oracle SQL.

Hope this helps.

Not applicable
Author

You probably need something like SUBSTR(MANTR, -1) = '4' instead of RIGHT

Not applicable
Author

Hi Javier,

The SQL Function let you write code with the same syntax and functions as your Database would have, so that is a space where you make a query.

Anonymous
Not applicable
Author

Javier

The reply by Lukasz is absolutely correct.

For SQL on Oracle [other brands of SQL may vary] you would need :

   SELECT DISTINCT MATNR, TXZ01

    FROM EBAN

    WHERE MATNR like '%4'  ;

Assuming I have understood correctly and need the last character to be 4.

Best Regards,     Bill

Not applicable
Author

Thanks, This was the script, really I need the number that star with 4, and the functions Left, Rigth, don't work.

[EBAN_W]:

ADD

LOAD *

;

  SQL

    SELECT DISTINCT MATNR, TXZ01

    FROM EBAN

    WHERE MATNR LIKE '4%'

  ;

jaimeaguilar
Partner - Specialist II
Partner - Specialist II

Hi,

It is important to mention that when you're extracting data from a Database, QlikView script can be divided in 2 segments:

SQL.png