Old Items

Jan 05, 2007 2 Replies

I'm looking at deleting all items which have: a)No Stock b)No On Order c)No Sales in 2006 d)No Sales in 2007



Easy? - in the immortal words of Dr.Phil "Hell No!" (oh yes, we have Dr.Phil in the UK too!)



As an absolute novice on SQL, and having read through my SAMS Teach yourself SQL in 10 minutes (they lie, it took at least an hour just to read the book), I can't seem to join together the tables properly using WHERE. I am told that there is a syntax error near WHERE.



I have so far: DELETE



FROM item



WHERE itemdynamic.quantity = 0



WHERE orderentry.quantityonorder = 0



WHERE DRL_PreRMS.Qty = 0



WHERE ????



WHERE ????


Just to note, that we went live with the system in October 2006, hence a special table of DRL_PreRMS.Qty which is the sales from our old system in one simple entry per ILC



The last two lines, I don't know how to get these quantities, for sale in



2006 and 2007

Appreciate it if anyone can help.



Thanks



Chris


The Retail Realm Store Utility has this function. Contact me for more info.

I would recommend using a utility if you *must* delete items. There is more to it than just deleting rows from the item table and an existing, tested utility that contains that logic is much better than reinventing the wheel.

To answer your SQL question, you only have 1 WHERE clause. If you have multiple conditions you bind them together using AND & OR...

SELECT * FROM tablename WHERE a = b AND c = d OR e = f

You can also control the precedence of the AND & OR operations using parentheses () - just like you would in good old math class....

Glenn Adams Tiber Creek C> I'm looking at deleting all items which have:

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required