question

jenny avatar image
0 Likes"
jenny asked jenny commented

SQL query to exclude values beginning with '1' in a specific column

Hi,

I want to select rows that doesn't not begin with '1' in a specific column, but it seems not to work, and an error message popped up.

" Table.query("SELECT * FROM Test WHERE `A` not like '1%'"); "

How should I do? Thanks in advance!

error-message.png

0418.fsm

FlexSim 24.0.3
sql querytable.query
error-message.png (26.4 KiB)
0418.fsm (26.0 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

·
Joerg Vogel avatar image
1 Like"
Joerg Vogel answered jenny commented
A LIKE '[0,2-9]%'

inverse clause NOT doesn't seem to work with clause of LIKE in FlexSim. I tried it with an regular expression what is allowed and excluded 1 [0,2-9]

· 3
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Felix Möhlmann avatar image Felix Möhlmann commented ·

It works if the LIKE expression is enclosed in parentheses and the NOT is placed in front of it.

Table.query("SELECT * FROM Test WHERE NOT ([A] LIKE '1%')")
1 Like 1 ·
jenny avatar image jenny Felix Möhlmann commented ·

Thanks a lot for your response.

0 Likes 0 ·
jenny avatar image jenny commented ·

Hi Joerg,

Thanks a lot for your response, your suggestions are very helpful. However I would like to ask if there is a possibility to support the query of 'not like' in the future?

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.