Welcome to Sign in | Help

Re: t-sql update sql server 2000

  •  02-17-2009, 4:39 PM

    Re: t-sql update sql server 2000

    e corect asa?

    UPDATE aaa SET Principal= 0

    WHERE DataInregistrare IN (

    SELECT TOP 2 DataInregistrare

    FROM aaa b

    WHERE b.CodContract=aaa.CodContract

    AND DATEDIFF(month, DataInregistrare, ( SELECT MIN(DataInregistrare)

    FROM aaa c

    WHERE c.CodContract=b.CodContract

    )

    ) = 0

    and DataInregistrare > ( SELECT MIN(DataInregistrare)

    FROM aaa c

    WHERE c.CodContract=aaa.CodContract)

    ORDER BY DataInregistrare asc

    )

    multumesc.

    alex.

View Complete Thread
Powered by Community Server (Commercial Edition), by Telligent Systems