Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
3 replies
Subscribers
5 subscribers
Views
1492 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
Integrations
I want to execute a query using the query database smart service, which looks li
moritzw
over 11 years ago
I want to execute a query using the query database smart service, which looks like this: delete from table_name where id in (123,345,etc.). The Id is of type integer. If I try to use an array variable it throws an error. Any ideas on how I could achieve this other than using MNI? Thanks!...
OriginalPostID-42987
OriginalPostID-42987
Discussion posts and replies are publicly visible
0
Sanjay
over 11 years ago
The way we've handled SQL WHERE IN clause is by using sub-string matching. Following two discussions provide insight to this approach:
forum.appian.com/.../528
forum.appian.com/.../6124
The substring function to be used differs according to RDBMS. In case of MySQL, it would be something like;
delete from table WHERE INSTR(ac!idList, concat(',', CAST(id AS CHAR), ',')) > 0
If 'id' field is char/varchar, no need to do CAST().
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
moritzw
over 11 years ago
Got it working. Thanks!
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
livior
over 11 years ago
I used a different query for this:
SELECT `id`, `field` FROM `table`
WHERE INSTR(ac!idList_txt, concat('|', CAST(id AS CHAR), '|')) > 0
with idList_txt set to "|"&joinarray(idList_int, "|")&"|"
as it misbehaved using the suggested query, especially for a single ID in the list idList_int.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel