Subject | Re: [firebird-support] How to update data? |
---|---|
Author | W O |
Post date | 2011-04-05T16:41:50Z |
Hello Woody
It works very well when there are dates, but the column LastDate can not be
null.
The PRODUCTS table has the column FirstDate, too.
How would be the sentence if:
- There are dates in MOVIMCAB then update PRODUCTS.LASTDATE with the last
date of MOVIMCAB for that product
- There are not dates in MOVIMCAB, then update PRODUCTS.LASTDATE with
PRODUCTS.FIRSTDATE
Thanks in advance.
Walter.
How about something like (untested)
It works very well when there are dates, but the column LastDate can not be
null.
The PRODUCTS table has the column FirstDate, too.
How would be the sentence if:
- There are dates in MOVIMCAB then update PRODUCTS.LASTDATE with the last
date of MOVIMCAB for that product
- There are not dates in MOVIMCAB, then update PRODUCTS.LASTDATE with
PRODUCTS.FIRSTDATE
Thanks in advance.
Walter.
How about something like (untested)
>[Non-text portions of this message have been removed]
> Update Products A set A.LastDate = (Select Max(B.Date) from MovimCab B
> Inner Join MovimDet C on (B.Movim_ID = C.Movim_ID) and (C.Product_ID =
> A.Product_ID))
>
> HTH
>
> Woody (TMW)
>