Forum Replies Created

Viewing 15 posts - 9,391 through 9,405 (of 10,144 total)

  • RE: The flow of an UPDATE STATEMENT with a FROM CLAUSE

    John

    I reckon this...

    [font="Courier New"]                UPDATE [A] SET

                                    [LAST_PAYMENT_DATE] =        [P].[LAST_PAYMENT_DATE]

                                    ,[NEXT_PAYMENT_DATE] =        .[NEXT_PAYMENT_DATE]

                                    ,[CUR_PAYMENT]                =        [P].[CUR_PAYMENT]

                                    ,[PMT_FREQ]                        =        .[AVG_PMT_FREQ]

                    FROM [dbo].[Amortization] [A]

                    INNER JOIN [##PS]        [P]

               ON [A].[ID_NUMBER] = [P].[ID_NUMBER]

                    INNER JOIN [##PS]        

               ON [A].[ID_NUMBER] = .[ID_NUMBER]

                    WHERE [A].[TBL_SOURCEID] <> '1'

               AND [P].[RECCNT] =...

  • RE: Using MAX in a SELECT Statement

    Hi Michael, thanks for your generous feedback.

    Yes, you're correct on both questions. Check that orderdate does have the time component - some systems remove it.

    Run the query, see what it...

  • RE: Error - Could not find server 'Database' in sysservers

    Good point Homebrew, however rather than risking locking users out of a live table, I'd run the update checks against the copy 😎

    Cheers

    ChrisM

  • RE: The flow of an UPDATE STATEMENT with a FROM CLAUSE

    Hi John, I reckon this must be close...

    [font="Courier New"]IF OBJECT_ID('tempdb..##PS') IS NOT NULL

       DROP TABLE ##PS

    CREATE TABLE ##PS

       ([ID_NUMBER] DECIMAL(25, 0) NOT NULL,

       [PAYMENT_DATE] DATETIME,

       [AMOUNT] FLOAT,

       [RECCNT] INT,

      ...

  • RE: The flow of an UPDATE STATEMENT with a FROM CLAUSE

    Nice work John. Lastly, you want the results to look like this? Resetting for each ID_NUMBER?

    ID_NUMBER PAYMENT_DATE ...

  • RE: Using MAX in a SELECT Statement

    Hi Michael

    If orderdate is datetime then it doesn't matter if there are more than one order per customer on the same day, because they're unlikely to be exactly the same...

  • RE: The flow of an UPDATE STATEMENT with a FROM CLAUSE

    Looking good John, and making a lot more sense now. Next thing is for you to give us some sample data in the form of a table script, which contains...

  • RE: Using MAX in a SELECT Statement

    Hi "mr"

    This should do the trick unless you have multiple orders per customer on a single day, in which case a small change will be required.

    [font="Courier New"]DECLARE @MinOrderDate DATETIME, @ExcludeDateMin...

  • RE: The flow of an UPDATE STATEMENT with a FROM CLAUSE

    Hi John

    I understand your frustration, which is why I asked if you could put into words what you are trying to achieve. Small changes in this kind of update will...

  • RE: Help writing function to get decimal from string

    It sure would be difficult Seth, but you don't have to come all the way over here for decent beer - have you tried Oregon Ales? Look out for Dead...

  • RE: The flow of an UPDATE STATEMENT with a FROM CLAUSE

    Hi John

    Can you describe in words what you're attempting to do with this part of the statement:

    SET @V1 = [COL1] = CASE @vEVAL = TRUE THEN 1 ELSE 0 END

    ...

  • RE: Help writing function to get decimal from string

    Dooza (11/18/2008)


    We have a Hob Goblin too, its where I usually end up at the end of the night as its always open late and doesn't attract your usual townies....

  • RE: Help writing function to get decimal from string

    Dooza (11/18/2008)


    Which pub in Reading? I visit every now and then, as I only live in High Wycombe.

    Heh I used to work near you, Gerrards Cross, two contracts about 3...

  • RE: Help writing function to get decimal from string

    Dooza (11/18/2008)


    Its nice seeing a post turn off-topic without being shut down immediately.

    Shhhh....

  • RE: Help writing function to get decimal from string

    Garadin (11/18/2008)


    I try not to torture myself with thoughts of good beer during the day. That said, any particular bitters worth trying out? I'm a hophead myself, but...

Viewing 15 posts - 9,391 through 9,405 (of 10,144 total)