title: GROUP BY statement does not work
body: <p>Here is my SQL Server query. When I execute this query, <code>Group by</code> was giving me a error</p>
  
  <blockquote>
    <p>Msg 8120, Level 16, State 1, Line 1<br>
    Column 'master_order.order_id' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.</p>
  </blockquote>
  
  <p>My tables in relation but he did not find why if cannot use group by its work</p>
  
  <pre><code>SELECT     
     master_order.order_id, master_order.order_no, article_order.article_name, 
     size.size_name, transaction_order.quantity, transaction_order.unit_name, 
     transaction_order.rate, transaction_order.amount, transaction_order.discount, 
     transaction_order.net_amount, master_order.order_date, buyer.buyer_name, 
     master_order.shipment_date, bank.bank_name, bank.bank_branch, bank.account_title, 
     master_order.confirmation_date, payment.payment_terms, agent.agent_name, 
     agent.company_name, currency.currency_symbol, master_order.half_day, 
     master_order.half_date, master_order.shipped_board_date, master_order.port_category, 
     port_info_setup.port_name, port_info_setup.country_name, master_order.revised, 
     master_order.confirmed, master_order.ex_factory, master_order.comments, 
     master_order.dis_type
  FROM 
     master_order 
  INNER JOIN
     transaction_order ON master_order.order_id = transaction_order.order_id 
  INNER JOIN
     size ON transaction_order.size_id = size.size_id 
  INNER JOIN
     article_order ON transaction_order.article_id = article_order.article_id 
  INNER JOIN
     buyer ON master_order.buyer_id = buyer.buyer_id 
  INNER JOIN
     port_info_setup ON master_order.port_id = port_info_setup.port_id 
  INNER JOIN
     payment ON master_order.payment_id = payment.payment_id 
  INNER JOIN
     currency ON master_order.currency_id = currency.currency_id 
  INNER JOIN
     bank ON master_order.bank_id = bank.bank_id AND buyer.buyer_id = bank.buyer_id 
  INNER JOIN
     agent ON master_order.agent_id = agent.agent_id
  GROUP BY 
     size.size_name
  </code></pre>