Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Deleteting records in two table
Wed, Sep 2 2009 10:10 AMPermanent Link

"Carlos"
Hi
I have two table in Master-Detail; both with date_order column

I need to delete all record from both table where the column date_order is
older than today - 60gg  AND
the column date_shipping  in Master is no empty.

Thanks

Carlos

Wed, Sep 2 2009 10:12 AMPermanent Link

"Carlos"

"Carlos" <carlos@noemail.com> ha scritto nel messaggio
news:09FB2DDF-BA9E-43E6-A9FE-CE9E195D5643@news.elevatesoft.com...
> Hi
> I have two table in Master-Detail; both with date_order column
>
> I need to delete all record from both table where the column date_order is
> older than today - 60gg  AND
> the column date_shipping  in Master is no empty.
>
> Thanks
>
> Carlos
>

I forget.....

both table contain column ORDER_N

Wed, Sep 2 2009 12:22 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Carlos,

<< I have two table in Master-Detail; both with date_order column

I need to delete all record from both table where the column date_order is
older than today - 60gg  AND the column date_shipping  in Master is no
empty. >>

Use something like this script:

START TRANSACTION;

DELETE FROM Detail INNER JOIN Master ON Detail.order_n=Master.order_n
WHERE Detail.date_order < CURRENT_DATE() AND Master.date_shipping IS NOT
NULL;

DELETE FROM Master WHERE date_order < CURRENT_DATE() AND date_shipping IS
NOT NULL;

COMMIT;

--
Tim Young
Elevate Software
www.elevatesoft.com

Thu, Sep 3 2009 3:24 AMPermanent Link

"Carlos"
Great !
Thank you very much !!!

Carlos

Image