title: SQL Query handing Jaspersoft Studio Read Fields
body: <p>I have this current query. I have tested it on 2 of the same verions of <em>Jaspersoft Studio</em>. When I hit read fields, one instance of the program gives me the columns I want however the other instance is stuck in a loop. I have checked the error logs and there is nothing for me to troubleshoot. </p>
  
  <p>I had theorized it was the query but why would it work in one instance and not the next. </p>
  
  <p>Where can I look to find out what is happening? What are my options?</p>
  
  <pre class="lang-sql prettyprint-override"><code>SELECT
  LOCATIONS.ID AS LOCATIONID,
  LOCATIONS.NAME AS LOCATIONNAME,
  PRODUCTS.REFERENCE,
  PRODUCTS.CODE AS BARCODE,
  PRODUCTS.NAME AS ITEM_NAME,
  STOCKDIARY.ATTRIBUTESETINSTANCE_ID,
  ATTRIBUTESETINSTANCE.DESCRIPTION AS ATTINSTANCEDESC,
  PRODUCTS.CATEGORY,
  TICKETLINES.UNITS,
  CATEGORIES.NAME AS CATEGORYNAME,
  STOCKDIARY.DATENEW,
  STOCKDIARY.REASON,
  SUM(CASE WHEN STOCKDIARY.UNITS &lt;0 AND STOCKDIARY.DATENEW &gt;=  $P{start_date} AND (STOCKDIARY.DATENEW) &lt;= $P{end_date} THEN STOCKDIARY.UNITS ELSE 0 END) AS UNITSOUT,
  SUM(CASE WHEN STOCKDIARY.UNITS &gt;=0 AND STOCKDIARY.DATENEW &gt;=  $P{start_date} AND (STOCKDIARY.DATENEW) &lt;= $P{end_date} THEN STOCKDIARY.UNITS ELSE 0 END) AS UNITSIN,
  SUM(CASE WHEN STOCKDIARY.DATENEW &lt;= $P{end_date} THEN STOCKDIARY.UNITS ELSE 0 END) AS STOCKTOTALNEW,
  SUM(CASE WHEN STOCKDIARY.DATENEW &lt;=  $P{start_date} THEN STOCKDIARY.UNITS ELSE 0 END) AS STARTINGBALANCE,
  SUM(TICKETLINES.UNITS) AS UNIT
  
  
  FROM TICKETLINES,
  STOCKDIARY
      LEFT JOIN
  LOCATIONS ON STOCKDIARY.LOCATION = LOCATIONS.ID
      INNER JOIN
  PRODUCTS ON PRODUCTS.ID = STOCKDIARY.PRODUCT
      LEFT JOIN
  CATEGORIES ON PRODUCTS.CATEGORY = CATEGORIES.ID
      LEFT JOIN
  ATTRIBUTESETINSTANCE ON STOCKDIARY.ATTRIBUTESETINSTANCE_ID = ATTRIBUTESETINSTANCE.ID
  
  
  WHERE products.name LIKE "%"
  
  GROUP BY LOCATIONS.NAME , PRODUCTS.REFERENCE , STOCKDIARY.ATTRIBUTESETINSTANCE_ID , ATTRIBUTESETINSTANCE.DESCRIPTION
  ORDER BY PRODUCTS.NAME
  </code></pre>