Recent content by NicholasP

  1. N

    looking to return 2nd/5th/10th from last record

    This worked, thank you very much. Not sure why it worked (even though I understand it conceptually), though I think that's more a matter of syntax. Specifically, if anyone could shed some light on "AS P ORDER"...I've not seen that before. Again, thanks a bunch! Nick
  2. N

    looking to return 2nd/5th/10th from last record

    If I use this: SELECT TOP 1 UST_PXs.ID, MTG_PXs.KeyDate FROM UST_PXs INNER JOIN MTG_PXs ON UST_PXs.ID = MTG_PXs.ID WHERE UST_PXs.ID NOT IN (SELECT TOP 1 UST_PXs.ID FROM UST_PXS) ORDER BY UST_PXs.ID DESC; I get the latest record (10/17/2014). I'm looking to return the second to last record...
  3. N

    looking to return 2nd/5th/10th from last record

    Hmmmm, so I was able to use this: SELECT TOP 2 UST_PXs.ID, MTG_PXs.KeyDate FROM UST_PXs INNER JOIN MTG_PXs ON UST_PXs.ID = MTG_PXs.ID WHERE UST_PXs.ID NOT IN (SELECT TOP 1 UST_PXs.ID FROM UST_PXS) ORDER BY UST_PXs.ID DESC; But it generates the last 2 records. I only want the 2nd to last record...
  4. N

    looking to return 2nd/5th/10th from last record

    Right now I'm trying to modify this sql statement SELECT .COID, [A].[company name], [B].Value FROM [A] INNER JOIN [B] ON [A].COID=[B].COID WHERE (Select Count(*) from [B] as S where Value >= [B].Value AND COID = [B].COID) = 2 ORDER BY [B].COID; from here: "[B]How do I get the second highest...
  5. N

    looking to return 2nd/5th/10th from last record

    I have 2 tables, UST_PXs and MTG_PXs and I'm trying to return the date in MTG_PXs based on the ID in UST_PXs...I have been trying DMAX without luck and I can get the right record using MAX, but that's an aggregate and I can't just tack a -2 or -5 on the end of it. Does anyone have any...
  6. N

    "Self" Join Query + Another Table?

    Thanks for your response, I would've got back to you sooner, but I was traveling... Your SQL is pretty close, but I only want to sum the values where the first value of "Status History" = 3 or C (hence why I've tried to use the LEFT function), not sum the values where any of "Status History"...
  7. N

    "Self" Join Query + Another Table?

    I'm really stumped on this one and maybe I haven't given enough info? As such I've attached a small version of the file to this post. If anyone has an idea on how to accomplish what I'm looking for, I'd greatly appreciate it. Thanks Nick
  8. N

    "Self" Join Query + Another Table?

    So I have the SQL code below which helps me determine the change in DACE....now I want to incorporate another table "Loans"....where I want to figure out how to sum all loans that have a "C" or a "3" in the field "Status History" for a given month I have a query that does what I want, but I am...
Back
Top Bottom