Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. kdbenson

    Match unlinked data based on datetimes

    I am trying to track the time between when a patient is discharged from a hospital to when they receive a follow-up telephone call. There is no direct link in the database (Teradata) between the hospital admission encounter and the folow-up telephone call so I would like to match the discharge...
  2. kdbenson

    Solving a SQL problem without using an OLAP function

    You are correct, there is no difference. I should have proof-read it more clearly. The second record in both recordsets above should be excluded. I meant to have only one record from 10/22 and for that record to have a NULL test_time. As to your point about a calendar table, I actually am...
  3. kdbenson

    Solving a SQL problem without using an OLAP function

    Hi, I have a SQL problem that I have solved using an OLAP function but I am wondering if there is a better way to do it - more elegant with potentially better performance. Here is the essence of the problem. Each person must take a test once per day over a specified period of time. They may...
  4. kdbenson

    Conditional Distinct Count

    Thanks, PH. Unfortunately, this doesn't give me the detail data. I forgot to mention this caveat in the first post. I had to do this in a couple of steps. First I create the unit by which I need to count. In this case it is a concatenation of Name, Assessment Date, and Assessment Type. Then I...
  5. kdbenson

    Conditional Distinct Count

    I need to do a conditional count on a number of assessments. It needs to be a distinct count over person and date. My raw data looks something like this: Name [tab]Date [tab]Assessment Type [tab]Assessment Time Chuck Smith [tab]6/7/2010 [tab]1 [tab]6/7/10 1:00 Chuck Smith [tab]6/7/2010 [tab]2...
  6. kdbenson

    SQL doesn't work - syntax or teradata issue

    Hi, I have a query that was suggested to me on an ANSI-SQL forum. When I tried it in Teradata (V2R5 or R6) it didn't run. The error I received was "3706: Syntax error: Expected something between '(' and the 'SELECT' keyword." I can't find any problem with the syntax so I was wondering if there...
  7. kdbenson

    Tricky grouping question

    Hi, I have a dataset similar to the following: Patient_ID Unit Start_Time End_time 1234 3C 5/2/09 12:00 5/5/09 13:00 1234 3FE 5/5/09 13:00 5/5/09 14:00 1234 3FE 5/5/09 14:00 5/7/09 18:00 1234 ICU 5/7/09 18:00 5/16/09 5:00 1234 3C 5/16/09 5:00 5/23/09 7:00 1234 3C 5/23/09 7:00 5/25/09 3:00 1234...
  8. kdbenson

    Grouping partially correlated data

    Code to create and populate example tables (using Teradata) is: CREATE TABLE crit_care(inpatient_data_id INTEGER, test_type VARCHAR(25), test_time TIMESTAMP, test_result VARCHAR(25), test_user_id INTEGER); CREATE TABLE poct(inpatient_data_id INTEGER, test_time timestamp, test_result...
  9. kdbenson

    Grouping partially correlated data

    Tests are given to patients and the time and result of the tests are recorded. Multiple tests can be given to a patient during their visit, which is uniquely identified by the inpatient_data_id. The data might look like this: inpatient_data_id test_time test_result 1234 2009-06-22 01:41:00 465...
  10. kdbenson

    Comparing timestamps for closest match

    Here is a solution that works. However, in reality the query requires a number of other tables with # of records > 1 million so I am concerned about performance. I would still appreciate any suggestions you have to make this more efficient. -Kevin SELECT ts.patient, ts.encounter_id...
  11. kdbenson

    Comparing timestamps for closest match

    I have two tables, Tests and Orders. There is not a direct relationship between a distinct test and a distinct order. The most granular link is Encounter_ID and there can be numerous tests and orders for a particular encounter. I need to create a list of all the tests with any associated orders...

Part and Inventory Search

Back
Top