It is currently Tue May 22, 2012 9:10 pm

All times are UTC + 2 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Delete unsaled products
PostPosted: Wed Dec 21, 2011 2:59 pm 
Offline

Joined: Fri Jan 04, 2008 10:16 am
Posts: 16
Hi all,

i have over 150.000 products in my ERP Database, an i think there are only 1000 - 5000 products we ever sold.
Now i want to delete all products we have naver soled.
How can i do that?


greez jada


Top
 Profile  
 
 Post subject: Re: Delete unsaled products
PostPosted: Wed Dec 21, 2011 3:39 pm 
Offline

Joined: Wed Jun 09, 2010 2:08 pm
Posts: 135
You may do this with a sql query like that:
Code:
select p.id,m.product_id
into temp t66
from product_product p LEFT OUTER JOIN stock_move m
on p.id=m.product_id
group by 1,2
order by 1;

update product_product set active = false from t66
where product_product.id = t66.id and t66.product_id is null;


This will deactivate all products with no stock movement at all.

Note: i have not tested this. Do not execute this query on your production database.


Top
 Profile  
 
 Post subject: Re: Delete unsaled products
PostPosted: Wed Dec 21, 2011 7:11 pm 
Offline

Joined: Wed Jan 27, 2010 6:21 pm
Posts: 797
Location: Auckland, NZ
I would not use that SQL query if you have any services or direct delivieries as not every sale/purchase creates a stock move, only ones that go via your own inventories.

_________________
Graeme


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 2 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:

Protected by Anti-Spam ACP