Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Problem with a numerical field in SQL

In the DB, the field has values "999" or "00999".

For example:

Field_A

$

999

10

00999

5

999

5

I make a query to the SQL DB:

TABLE_001:

SQL SELECT

    Field_A,

     $

FROM DB."TABLE_001";

Result:

Field_A

$

999

10


But if I add a "Where" in a query.

TABLE_001:

SQL SELECT

    Field_A,

     $

FROM DB."TABLE_001"

Where Field_A = '00999';


Result:

Field_A

$

00999

                             5


I need to make the query and get the values 999 and 00999


Field_A

$

999

10

00999

5

999

5

Thanks!

1 Solution

Accepted Solutions
marcus_sommer

Try it with:

TABLE_001:

Load *, text(Field_A) as Field_A_New;

SQL SELECT

    Field_A,

     $

FROM DB."TABLE_001";

- Marcus

View solution in original post

7 Replies
jpenuliar
Partner - Specialist III
Partner - Specialist III

Try a SQL IN Operator:

Field_A IN('999','00999')



Regards,

JP

Anonymous
Not applicable
Author

Holla Jonathan.


The problem is that the field "Field_A" has not only those values (999 and 00999), it has many others.


But with these two I have the incident that you publish.

jpenuliar
Partner - Specialist III
Partner - Specialist III

I amnot sure what you exactly want to achieve, but if you want to load all values matching '999' and '00999' from your SQL result, you can do a "Resident Load" :

Load Field_A resident tab1 where Match(Field_A,'999','00999');

Anonymous
Not applicable
Author

No, I need load all values.

Filed_A

CHA20104

COMCRDB
ESC30601
MOE60703
TIG30501
VLO30103
999
0999
16100

Those are the values ​​of the field (In a DB). But when I load in QV the value 00999 is joined with the value 999.


Filed_A

CHA20104

COMCRDB
ESC30601
MOE60703
TIG30501
VLO30103
999
16100

It is understood?

marcus_sommer

Try it with:

TABLE_001:

Load *, text(Field_A) as Field_A_New;

SQL SELECT

    Field_A,

     $

FROM DB."TABLE_001";

- Marcus

Anonymous
Not applicable
Author

WHERE (CAST Field_A AS INT) = '999'

Anonymous
Not applicable
Author

This is what I need. Thank @Marcus!!!