Re: [Emerald] Dropping data from a table
Dale E. Reed Jr. ( (no email) )
Fri, 04 Dec 1998 15:46:44 -0800
Brandon Bryant wrote:
>
> Interesting problem. I just changed my billing cycle from 30-30 to 1-1.
> Unfortunately, there was a credit card batch that had been generated
> before I did that, and of course it's wrong. What I want to do is delete
> the invoices and externaltrans stuff for those. I did a
> select * from invoices where type = "Credit Card" and date = "Nov 13 1998
> 12:00AM"
> select * from externaltrans where reqdate > "Nov 12 1998 12:00AM"
>
> And I got a list of (I think) all the data I need to remove. If I remove
> the invoice from these two areas, can I then re-create the batch with the
> new dates and get on with my life? And if so, what is the SQL command to
> delete this data?
Yes you can You need three queries, two of them based on your
original one.
Delete From InvoiceItems Where InvoiveID In
(select invoiceid from invoices
where type = 'Credit Card' and date = '11/1398'
)
Delete From ExternalTrans Where InvoiveID In
(select invoiceid from invoices
where type = 'Credit Card' and date = '11/1398'
)
Delete from invoices
where type = 'Credit Card' and date = '11/1398'
-- Dale E. Reed Jr. (daler@iea-software.com)_________________________________________________________________ IEA Software, Inc. | RadiusNT, Emerald, and NT FAQs Internet Solutions for Today | http://www.iea-software.com