Subject | Re: UPDATE sql with join like search |
---|---|
Author | Virgo Pärna |
Post date | 2013-02-25T14:34:15Z |
On Mon, 25 Feb 2013 14:29:14 +0100, Svein Erling Tysvær <svein.erling.tysvaer@...> wrote:
Firebird features.
--
Virgo Pärna
virgo.parna@...
>Yes, that's why I was asking advice.:)
> This can be very slow, Virgo, but I guess you already know that.
>
>I'm using 2.5.2.
> Depends on which Firebird version you use.
>
> Try either:And this works just as needed. Thank you. I managed to miss this part of
>
> EXECUTE BLOCK AS
> DECLARE VARIABLE V1 INTEGER;
> BEGIN
> FOR SELECT DISTINCT VALUE1 FROM TABLE2 WHERE VALUE2 = <whatever> INTO :
> V1 DO
> BEGIN
> UPDATE TABLE1
> SET VALUE1 = NULL
> WHERE VALUE1 = :V1;
> END
> END
>
Firebird features.
> If you use an old version where EXECUTE BLOCK isn't available, you could trSince I'm using 2.5.2 that's not an issue.
> y:
>
> UPDATE TABLE1 T
> SET T.VALUE1 = NULL
> WHERE
> EXISTS(SELECT * FROM TABLE2 A WHERE VALUE2 = ? AND T.VALUE1 = A.VALUE
> 1)
>
> The last alternative will still use NATURAL, but once upon a time Firebird
> didn't transform IN into EXISTS (that's why I stopped using IN <subselect>
> last century), so it could be considerably quicker than your alternative.
>
--
Virgo Pärna
virgo.parna@...