What you printed is what the DB is seeing. The DB doesn't know Perl so this query will return records where special_fields is either the string ".join(" or is the string ",map(->quote(), red blue orange green)).". You aren't getting any records returned because you don't have any records with either of those two strings in that column (not surprisingly).
You need to have that Perl code executed, so you have to take that code outside of the quotes, that is, outside of the qq( ... ). The quote (") in this code:
engine IN (".join(
you appear to think is ending the quoted string such that Perl executes the concatenation operator (.) and calls the join function. But, as I said way up there, a quote (") doesn't end a quoted string that was started with qq(.
I'm going to stop right there because I think you can figure out the rest. You appear to just have had a hard time seeing this.
No, I'll give you one more hint. You might want to change from qq( ... ) to something like qq{ ... }, qq< ... >, or qq[ ... ], because ending a qq( ... ) string having unmatched parens (which is what the first part of your statement needs to be) is a bit tricky. Though you might want to experiment with the trickier syntax after you get it working just for your own enlightenment.
Good luck.
- tye
In reply to Re^7: in, ands, ors in query (qq)
by tye
in thread in, ands, ors in query
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |