Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
每个月我们都需要根据 CSV 文件创建一个报表。这是一个例子:
SELECT Name, OrderID, Product, Price From Orders Where OrderID = (here is where I am stuck);
所以基本上每个月我们都会得到一组新的 CSV 格式的大约 50 到 60 个 OrderID 值。如何为这些 OrderID 创建一个输出 Name、OrderID、Product、Price 的语句?
我想你正在寻找这样的东西。
SELECT Name, OrderID, Product, Price From Orders Where OrderID In ('row1', 'row2', 'row3', ...);
假设您可以将 ID 放在逗号分隔的列表中,您将使用 IN 子句:
SELECT Name, OrderID, Product, Price From Orders Where OrderID IN (23,567,78);