我正在为我的项目使用 sql server 2008。我有两个名为 1. Customer_Invoice2.Orders.
的表,并且两个表都有Customer_Invoice_ID列。在Customer_Invoice表中PK和在Orders表中FK。
现在我的要求是获取top 100 records from Customer_Invoice表和then for each Customer_Invoice_ID, i want all records from orders table. 所以我想要 Customer_Invoice_ID 存在于 Customer_Invoice 表中的订单表中的所有记录。
所以首先,
Select top 100 * from Customer_Invoice
然后为每个Customer_Invoice_ID从Order table.
谁能指导我如何编写相同的查询?