-3

これが私のSQL Serverクエリです。このクエリを実行するとGroup by、エラーが発生しました

メッセージ 8120、レベル 16、状態 1、行 1
列 'master_order.order_id' は、集計関数にも GROUP BY 句にも含まれていないため、選択リストでは無効です。

関連する私のテーブルですが、その作業によってグループを使用できない場合、彼は理由を見つけられませんでした

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
4

1 に答える 1