Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8389853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:50:01+00:00 2026-06-09T18:50:01+00:00

I am trying to write a script that will return the latest values for

  • 0

I am trying to write a script that will return the latest values for a unique documentid-physician-patient triplet. I need the script to act similar to a group by statement, except group by only works with one column at a time. I need to date and status information for only the most recent unique triplet. Please let me know what you will need to see from me to help. Here is the current, very bare, statement:

    SELECT
        TransmissionSend.CreateTimestamp,
        TransmissionSendItem.Status,
        TransmissionSendItem.PhysicianId,
        TransmissionSendItem.DocumentIdDisplay,
        Utility.SqlFunctions_NdnListToAccountList(TransmissionSendItem.NdocNum) AS AccountNum
    FROM
        Interface_SFAX.TransmissionSend,
        Interface_SFAX.TransmissionSendItem
    WHERE
        TransmissionSend.ID = TransmissionSendItem.childsub --I don't know exactly what this does, I did not write this script. It must stay here though for the exact results.

    ORDER BY TransmissionSend.CreateTimestamp DESC -- In the end, each latest result of the unique triplet will be ordered from most recent to oldest in return

My question is, again, how can I limit results to only the latest status for each physician id, document id, and account number combination?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T18:50:03+00:00Added an answer on June 9, 2026 at 6:50 pm

    First select the MAX(date) with the documentid GROUP BY documentid then select all data from the table by the first select result for example with an inner join.

    SELECT table.additionalData, J.id, J.date
    FROM table
    INNER JOIN (SELECT id, MAX(date) AS date 
                FROM table GROUP BY id) AS J 
    ON J.id = table.id 
    AND J.date /* this is the max date */ = table.date
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a script that will create a user in MediaWiki, so
I'm trying to write a script that will download files from an FTP server.
I'm currently trying to write a script that will connect to a site using
THANKS FOR HELPING!!! Ok... So I am trying to write a script that will
I'm trying to write a Photoshop script that will show all layers of a
I'm trying to write an R script that will go through a dataframe that
I'm trying to write a bash script that will process a list of files
I'm trying to write a Perl script that will parse the output of the
I am trying to write a custom script that will keep a list of
I am trying to write a python script that will change my cwd to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.