title: How to query the warehouse's branch in SAP B1?
body: <p>I'm new to SAP B1 (version 9.1) and I haven't found how can I do the following: </p>
  
  <p>I'm trying to list all items in stock by branch but I don't know how to get the warehouse's branch. I read that a warehouse belongs to only one branch but  I don't see how it's done. I'm able to list all items in stock in all warehouses by issuing this query:</p>
  
  <pre><code>SELECT T1."WhsName", T2."ItemName", T0."OnHand" 
  FROM OITW T0 INNER JOIN OWHS T1 ON T0."WhsCode"=T1."WhsCode"
               INNER JOIN OITM T2 ON T0."ItemCode"=T2."ItemCode"
  WHERE T0."OnHand" &gt; 0
  ORDER BY T1."WhsName" ASC, T0."OnHand" DESC;
  </code></pre>
  
  <p>No idea how to get the warehouse's branch. Can you help me?</p>
  
  <p>Thanks in advance.</p>