question

Patrick Cloutier avatar image
0 Likes"
Patrick Cloutier asked Patrick Cloutier answered

Trying to write this SQL statement

I'm trying to write this SQL Statement but there is a problem with the line before last:

Table result = Table.query("SELECT * FROM FRList1 \
WHERE [ChoiceC2] > 0 \
AND [Content] > 0 \
AND [Content] < 10 \
AND 'token.item.Purity' = [Purity] \
ORDER BY ChoiceC2 ASC");

token.item.Purity is a string label and [Purity] is a string column in my table.

But I never get a match because of that line although there are matches that I can see.

Is my synthax correct?

Thanks a lot,

FlexSim 21.2.4
sql query
· 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.

Matthew Gillespie avatar image Matthew Gillespie ♦♦ commented ·
@Patrick Cloutier It doesn't know what token is.
0 Likes 0 ·
Patrick Cloutier avatar image Patrick Cloutier Matthew Gillespie ♦♦ commented ·
How do I write it then?
0 Likes 0 ·
Patrick Cloutier avatar image Patrick Cloutier Matthew Gillespie ♦♦ commented ·
I've spent hours in the manual and on w3schools and I can't figure it out...
0 Likes 0 ·

1 Answer

Patrick Cloutier avatar image
1 Like"
Patrick Cloutier answered

I found it !!!

Table result = Table.query("SELECT * FROM FRList1 \
WHERE [ChoiceC2] > 0 \
AND [Content] > 0 \
AND [Content] < 10 \
AND [Purity] = $1 \
ORDER BY ChoiceC2 ASC", token.item.Purity);
5 |100000

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