Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

mprsuper123
New Contributor

Syntax error on where clause why ?


Sprvsr:
LOAD   EMPL_GROUP_DESC as [SprvsrName],
    EMPL_GROUP_CD as [SprvsrID];
   
SQL SELECT *
FROM [DELTEKTE].[TC_0012].[EMPL_GROUP];

LEFT JOIN (Sprvsr)
LOAD   EMPL_ID as [TE_Employee_ID],
    EMPL_GROUP_CD  as [SprvsrID];
   
SQL SELECT *
FROM [DELTEKTE].[TC_0012].[EMPL_GROUP_EMPL]
WHERE MATCH (left[EMPL_GROUP_CD], 1)= 'M';

1 Solution

Accepted Solutions
MVP
MVP

Re: Syntax error on where clause why ?

Hi,

Use the Match() function in the LOAD part. Match() is a QlikView function, not a standard SQL function. This should work (check parentheses):

LOAD   EMPL_ID as [TE_Employee_ID],

    EMPL_GROUP_CD  as [SprvsrID]

WHERE MATCH(Left([EMPL_GROUP_CD], 1) = 'M'

;

SQL SELECT *

FROM [DELTEKTE].[TC_0012].[EMPL_GROUP_EMPL]

;

Although you are using two functions instead of one for the same purpose, so you can either use WildMatch() or even better, just Left() in the same position as the previous.

WHERE LEFT([EMPL_GROUP_CD], 1) = 'M'

or

WHERE WILDMATCH([EMPL_GROUP_CD], 'M*')

or

WHERE [EMPL_GROUP_CD] LIKE 'M*'

Hope that helps.

Miguel

3 Replies
MVP
MVP

Re: Syntax error on where clause why ?

Try

..

WHERE MATCH ( left([EMPL_GROUP_CD], 1), 'M');

or

WHERE  left( [EMPL_GROUP_CD], 1) = 'M';

mprsuper123
New Contributor

Re: Syntax error on where clause why ?

Hello Swuehl,

I got this error message

MVP
MVP

Re: Syntax error on where clause why ?

Hi,

Use the Match() function in the LOAD part. Match() is a QlikView function, not a standard SQL function. This should work (check parentheses):

LOAD   EMPL_ID as [TE_Employee_ID],

    EMPL_GROUP_CD  as [SprvsrID]

WHERE MATCH(Left([EMPL_GROUP_CD], 1) = 'M'

;

SQL SELECT *

FROM [DELTEKTE].[TC_0012].[EMPL_GROUP_EMPL]

;

Although you are using two functions instead of one for the same purpose, so you can either use WildMatch() or even better, just Left() in the same position as the previous.

WHERE LEFT([EMPL_GROUP_CD], 1) = 'M'

or

WHERE WILDMATCH([EMPL_GROUP_CD], 'M*')

or

WHERE [EMPL_GROUP_CD] LIKE 'M*'

Hope that helps.

Miguel

Community Browser