我正在我的数据库上运行一个非常简单的 SQL 查询,它似乎一遍又一遍地返回相同的记录,从而创建了一个无限循环。也许我遗漏了一些明显的东西,但我没有看到。这是查询:
select s.customer as 'Customer',
s.store as 'Store',
s.item as 'Item',
d.dlvry_dt as 'Delivery',
i.item_description as 'Description',
mj.major_class_description as 'Major Description',
s.last_physical_inventory_dt as 'Last Physical Date',
s.qty_physical as 'Physical Qty',
s.avg_unit_cost as 'Unit Cost',
[qty_physical] * [avg_unit_cost] as Value
from database.DELIVERY d,
database.STORE_INVENTORY s,
database.ITEM_MASTER i,
database.MINOR_ITEM_CLASS mi,
database.MAJOR_ITEM_CLASS mj,
database.STORE_INVENTORY_ADJUSTMENT sa
where sa.store = s.store
and s.last_physical_inventory_dt between '6/29/2011' and '7/2/2011'
and s.customer = '20001'
and s.last_physical_inventory_dt is not null
有一条记录落在 2011 年 7 月 1 日,它会永远重复,直到我取消查询。
对防止这种情况有任何帮助吗?