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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Syntax for load ... from ... where = ... or where = ...

Hi,

i load data from a database. Now i want to load only data where the field product = *sprite* or product = "cola" is.

What is the correct syntax for it?

FROM `databasename`.`tablename` where product = '*sprite*' or where product = '*cola*'

regards,

Fritz

1 Solution

Accepted Solutions
marcus_sommer

You need to know which wildcards and quotes your database supported (look there in the help or ask google). Also it might be helpful to change the equal-sign with like:

where product like '*cola*' or product like '*sprite*'

- Marcus

View solution in original post

6 Replies
puttemans
Specialist
Specialist

Hi,


You only need the where once :


FROM `databasename`.`tablename` where product = '*sprite*' or product = '*cola*';

Not applicable
Author

where  product = '*sprite*' or product = '*cola*';

rubenmarin

Hi, the "= '*cola*'" maybe tries to find that exact string.

If doesn't works try with:

where product like '%sprite%' or product like '%cola%';

Anonymous
Not applicable
Author

I try it like this, but now qlik sense loads no data. There is no error.

Is SQL SELECT a problem?

LOAD ID,

product,

price;

SQL SELECT ID,

product,

price

FROM `databasename`.`tablename` where product = '*cola*' or product = '*sprite*';

I try it also with %cola%.

regards,

Fritz

marcus_sommer

You need to know which wildcards and quotes your database supported (look there in the help or ask google). Also it might be helpful to change the equal-sign with like:

where product like '*cola*' or product like '*sprite*'

- Marcus

Anonymous
Not applicable
Author

Thank you Marcus and the others for help!

With like and % it works. I use a MySQL Database.

regards,

Fritz