Can not delete from specified tables

G

Guest

I have two tables with an interjoin. dbo_IMINVLOC_SQL and dbo_IMITMIDX_SQL .
The first is inventory items in a location and the second is the master
inventory table
I need to delete items in the dbo_IMINVLOC_SQL table based on criteria from
both tables. Below is the query.

DELETE dbo_IMINVLOC_SQL.*, dbo_IMINVLOC_SQL.item_no,
dbo_IMINVLOC_SQL.qty_on_hand, dbo_IMINVLOC_SQL.qty_allocated,
dbo_IMINVLOC_SQL.qty_bkord, dbo_IMINVLOC_SQL.qty_on_ord,
dbo_IMINVLOC_SQL.last_sold_dt, dbo_IMINVLOC_SQL.qty_sold_ytd,
dbo_IMINVLOC_SQL.active_ords, dbo_IMITMIDX_SQL.activity_cd
FROM dbo_IMITMIDX_SQL INNER JOIN dbo_IMINVLOC_SQL ON
dbo_IMITMIDX_SQL.item_no = dbo_IMINVLOC_SQL.item_no
WHERE (((dbo_IMINVLOC_SQL.qty_on_hand)<1) AND
((dbo_IMINVLOC_SQL.qty_allocated)<1) AND ((dbo_IMINVLOC_SQL.qty_bkord)<1) AND
((dbo_IMINVLOC_SQL.qty_on_ord)<1) AND
((dbo_IMINVLOC_SQL.last_sold_dt)<20040101) AND
((dbo_IMINVLOC_SQL.qty_sold_ytd)<1) AND ((dbo_IMINVLOC_SQL.active_ords) Is
Null) AND ((dbo_IMITMIDX_SQL.activity_cd)="O"));

Thanks in advance for your help.
 
E

Edward G

Looks to me like the problem is this part:
dbo_IMITMIDX_SQL.activity_cd
is included in the Delete part of the query instead of just the criteria.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top