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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.