次のクエリを使用しています。
SELECT Products.SKU,
Buy_Orders_Details_Requested_But_Not_Sent_By_Customer.Customer,
First(Buy_Orders_Details_Requested_But_Not_Sent_By_Customer.Requested_But_Not_Sent) AS FirstOfRequested_But_Not_Sent
FROM Products
LEFT JOIN Buy_Orders_Details_Requested_But_Not_Sent_By_Customer
ON Products.SKU = Buy_Orders_Details_Requested_But_Not_Sent_By_Customer.SKU
GROUP BY Products.SKU,
Buy_Orders_Details_Requested_But_Not_Sent_By_Customer.Customer;
「関数の引数が無効です」というメッセージが表示されます。
私が実行すると:
SELECT Products.SKU,
Buy_Orders_Details_Requested_But_Not_Sent_By_Customer.Customer,
First(Buy_Orders_Details_Requested_But_Not_Sent_By_Customer.Quantity_Ordered) AS FirstOfQuantity_Ordered
FROM Products
LEFT JOIN Buy_Orders_Details_Requested_But_Not_Sent_By_Customer
ON Products.SKU = Buy_Orders_Details_Requested_But_Not_Sent_By_Customer.SKU
GROUP BY Products.SKU,
Buy_Orders_Details_Requested_But_Not_Sent_By_Customer.Customer;
問題なく動作します。2 つのクエリの唯一の違いは、集計されるフィールド (Quantity_Ordered または Requested_But_Not_Sent) です。基になるレコードセット "Buy_Orders_Details_Requested_But_Not_Sent_By_Customer" は、それ自体がクエリであり、テーブルではありません。そのクエリ自体を開くと、問題なく正常に動作します。「Requested_But_Not_Sent」には NULL が含まれていません。クエリ Buy_Orders_Details_Requested_But_Not_Sent_By_Customer の内容を一時テーブルにダンプし、クエリではなくそのテーブルに結合すると、正常に動作します。
Buy_Orders_Details_Requested_But_Not_Sent_By_Customer クエリのうち、機能するフィールドと機能しないフィールドがあることがわかりました (前述のとおり)。なぜこれが起こるのでしょうか?基になるレコードセットがテーブルであるかクエリであるかが関係するのはなぜですか? そして最も重要なことは、一時テーブルを使用せずに探している結果を得るにはどうすればよいでしょうか? さらに情報が必要な場合は、指定してください。提供します。
ありがとう!