Archives of the TeradataForum
Message Posted: Mon, 28 Mar 2011 @ 14:57:42 GMT
I am new to Teradata environment but have worked within the SQL Server environment so I am not expecting an major issues.
Here is my situation, I have the following fields that I am working with: personalID, Topic, a Activetimestampfield and then a ReturnTimestampfield. What I need to do is group by PersonalId all of the records that have a count > 1.
Then need to check the first Activetimestampfield with the NEXT Activetimestampfield , if they are within 14 days i need to record the topic of next record. I need to do this for each record per personalID,.
I am thinking i could build a temp table to push occurrences for each personalID to seperate columns but was not sure if this was the best approach, anyone have any ideas or been faced with a similar situation. I know Excel handles "Nth Occurance" and I could not find a function like that for SQL. I know in other lagunages I could put values into an array setting variables for each but do not believe this can be done in SQL.
Any help would be greatly appreciated!
|Copyright 2016 - All Rights Reserved|
|Last Modified: 28 Jun 2020|