title: HPQC Report Query Builder
body: <p>I am interested in solving a SQL-query puzzle which drives me nuts. I have to build a query which affects three tables. I tried to solve this via a procedure, but I guess the HPQC Report Query Builder is not able to deal with a procedure. So I have to use another solution.</p>
  
  <p>Here is the 3-step problem: I identify a <strong>bug_id</strong> from the first table. With this id, I feed another table to get the corresponding <strong>user_id</strong> from the second table. As a last step, I lookup the corresponding <strong>username</strong> with the user_id from the second table.</p>
  
  <pre><code>SELECT bug_id FROM Bugs WHERE (Color='green') --&gt; RESULT_A
  SELECT link_id FROM Link WHERE (the_user = RESULT_A) --&gt; RESULT_B
  SELECT username FROM Users WHERE (user_id = RESULT_B)
  </code></pre>
  
  <p>I tried to fiddle my way through JOINS but it seems not to work. Therefore I tried to simplify the problem by using only a simple 2-step (lookup) example:</p>
  
  <pre><code>SELECT LINKTABLE.USERID, USERTABLE.USERNAME
  FROM  LINKTABLE 
  INNER JOIN USERTABLE 
  ON LINKTABLE.USERID = USERTABLE.USERID;
  </code></pre>
  
  <p>HPQC reports: invalid Statements.</p>
  
  <p>Is there anybody who could help me building a simple lookup query ?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>This is my solution for a join over 2 tables:</p>
  
  <pre><code>SELECT
   b.BG_BUG_ID as Defect,
   b.BG_USER_09 as PTR,
   b.BG_STATUS as Status,
   b.BG_SEVERITY as Severity,
   b.BG_USER_01 as Category,
   b.BG_USER_66 as Theme,
   b.BG_USER_64 as Page_Impacted,
   b.BG_DETECTION_DATE as Detected_on_Date,
   b.BG_DETECTION_VERSION as Detected_in_Version,
   l.LN_ENTITY_ID,
   l.LN_ENTITY_TYPE
  FROM
   BUG b
  JOIN
   LINK l
  ON
   b.BG_BUG_ID = l.LN_BUG_ID
  WHERE
   (b.BG_BUG_ID = 5555)
  AND
   (l.LN_ENTITY_TYPE = 'TEST')
  ORDER BY b.BG_BUG_ID ASC
  </code></pre>
  
  <p>Now I need to add a third information coming from another table. So there have to be 2 JOINS..</p>