To properly format that, please wrap your code in code tags. If you don't you could end up here Worst Nodes
. There is a subset of HTML that monks are allowed to use. You can read about that here. Writeup Formatting Tips
You'll need to quote the column "i.ItemR/E" to get it to work. Like blue_cowdawg suggests, this is a SQL problem not a Perl one. If you cut the SQL code out and run it in isql or whatever SQL environment you use, you'll see that the dB Server doesn't understand the SQL. It can be difficult for a new Perl programmer to determine where the error is. Is it in the dB or is it in Perl? Please look at my earlier post and click in the link "Before asking a database related question". gmax has an excellent writeup about this. It will probably be a big help.
Good luck and please go back and wrap your code in code tags.
Are you posting in the right place? Check out Where do I post X? to know for sure.
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
Want more info? How to link or
or How to display code and escape characters
are good places to start.