Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 combining 2 rows and then evaluating them

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2007-01-11 : 06:47:44
folkert writes "I have a table with a field 'when' which is of type 'datetime' and a field 'data' which is of type 'char(32)'.
Now I would like to have a distinct() of the value of 'data' for the row 'n' combined with the value of 'data' for the row n + 1. Now the difficulty is that type 'when' on row n + 1 is not always on the same interval compared to row n.
To make myself maybe a bit more clear, in pseudocode it would be:
array a[...] contains all data
now i would like to do:

temp[] = new array();
temp_index = 0;
for(loop=0; loop<number_of_elements; loop++)
{
// '+' => concatenate, not addition
temp[temp_index++] = a[loop] + a[loop + 1];
}

and then I would like to have a distinct of array 'temp()' together with the frequency of each distinct pair."

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-01-11 : 07:01:07
see this topic http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=77393



Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -