Re: [Emerald] payment / invoice associations

Dale E. Reed Jr. ( (no email) )
Wed, 16 Jun 1999 09:14:26 -0700

Josh Hillman wrote:
>
> I can see how that would happen. I know that all charges in the system
> (originating from the charges table) should have a quantity of one, so the
> following script would fix all of them, right?
>
> update ii
> set ii.quantity = 1
> from invoiceitems ii, charges c
> where exists (select c.itemid
> from charges c, invoiceitems ii
> where c.itemid = ii.itemid)
> and c.itemid = ii.itemid
> and quantity > 1

Not sure why you bring the tables in twice. This should work:

Update ii
Set ii.Quantity = 1