title: Mssql query problems
body: <p>I have a MSSQL Database and the following tables</p>
  
  <p>WHE</p>
  
  <pre><code>+----------+----------+----------+
  | Item No_ | Bin Code | Quantity |
  +----------+----------+----------+
  | 0000955  | K2-3-3   | -2       |
  +----------+----------+----------+
  | 0000955  | C2-2-4   | 3        |
  +----------+----------+----------+
  | 0000955  | K2-3-3   | 5        |
  +----------+----------+----------+
  | 0000955  | K2-3-3   | 1        |
  +----------+----------+----------+
  | 0000955  | C2-2-4   | -1       |
  +----------+----------+----------+
  | 0000955  | K2-3-3   | -10      |
  +----------+----------+----------+
  | 0000955  | C2-2-4   | 7        |
  +----------+----------+----------+
  | 0000955  | K2-3-3   | 3        |
  +----------+----------+----------+
  | 0000955  | C2-2-4   | 8        |
  +----------+----------+----------+
  </code></pre>
  
  <p>Item</p>
  
  <pre><code>+----------+--------+
  | Item No_ | Desc   |
  +----------+--------+
  | 0000054  | Spring |
  +----------+--------+
  | 0000087  | Ring   |
  +----------+--------+
  </code></pre>
  
  <p>When i execute a query</p>
  
  <pre><code>select [Bin Code],
  sum([Quantity])
  from dbo.[whe]
  where [Item No_]='0000955'GROUP BY [Bin Code]
  </code></pre>
  
  <p>Get returned results</p>
  
  <pre><code>+----------+----------+
  | Bin Code | Quantity |
  +----------+----------+
  | K2-3-3   | -3       |
  +----------+----------+
  | C2-2-4   | 17       |
  +----------+----------+
  </code></pre>
  
  <p>But I need something like this to work</p>
  
  <pre><code>select  we.[Bin Code],
  sum(we.[Quantity]),
  it.[Item No_],
  it.[Desc],
  from dbo.[whe] as we,
  dbo.[item] as it
  and it.[No_]=we.[Item No_] 
  </code></pre>
  
  <p>I would want something like this as a result </p>
  
  <pre><code>+-----------------+--------+----------+----------+
  | Item No_ | Desc   | Bin Code | Quantity |
  +-----------------+--------+----------+----------+
  | 0000955         | Valve  | K2-3-3   | -3       |
  +-----------------+--------+----------+----------+
  | 0000955         | Valve  | C2-2-4   | 17       |
  +-----------------+--------+----------+----------+
  </code></pre>
  
  <p>But the query is not executable and getting the error like </p>
  
  <blockquote>
    <p>Column 'dbo.Item.No_' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.</p>
  </blockquote>