SQL Query Stuck in Infintite Loop -
i'm running pretty simple sql query on database, , seems returning same record on , over, creating infinite loop. maybe i'm missing obvious, don't see it. here's query:
select s.customer 'customer', s.store 'store', s.item 'item', d.dlvry_dt 'delivery', i.item_description 'description', mj.major_class_description 'major description', s.last_physical_inventory_dt 'last physical date', s.qty_physical 'physical qty', s.avg_unit_cost 'unit cost', [qty_physical] * [avg_unit_cost] value 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 sa.store = s.store , s.last_physical_inventory_dt between '6/29/2011' , '7/2/2011' , s.customer = '20001' , s.last_physical_inventory_dt not null there 1 record falls on 7/1/2011 , repeats forever until cancel query.
any on preventing this?
you're joining these tables: database.delivery, database.item_master, database.minor_item_class, , database.major_item_class - without specifying how join them. need specify how these tables joined rest.
if each of these tables has 100 rows, give 100 * 100 * 100 * 100 rows (100 million) minimum rows! (see cartesian join)
Comments
Post a Comment