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)
 Need Help to get correct Output

Author  Topic 

denfer
Starting Member

12 Posts

Posted - 2007-11-13 : 08:58:37
Hi,
Here are my Data
I have a list of Object 'Obj' that have several type of 'Task'
Obj1 => Task1, Task2, Task3 Task4
Obj2 => Task1, Task2, Task3 Task4
Obj3 => Task1, Task2, Task3 Task4
All the 'Obj' have the same number and type of 'Task'

All this 'Obj' have the same 'Job'
Obj1 => Job1
Obj2 => Job1
Obj3 => Job1

Each 'Task' can have different 'Size', 'Position' and 'ObjID'
Task1 => S11, P11, Obj1
Task1 => S12, P12, Obj2
Task1 => S13, P13, Obj3
Task2 => S21, P21, Obj1
Task2 => S22, P22, Obj2
Task2 => S23, P23, Obj3
Task3 => S31, P31, Obj1
Task3 => S32, P32, Obj2
Task3 => S33, P33, Obj3

I need to get the list of 'Obj' that are identical.
That mean that they have for ALL 'Task' Identical 'Size' and 'Position'.
Obj1 and Obj2 are identical only if :
S11 = S12 AND P11 = P21 AND
S21 = S22 AND P21 = P22 AND
S31 = S32 AND P31 = P32

All the data are in the same table
TaskID, Size, Position, ObjID, JobID

I found a solution with two While loop but it's not fast enough
I someone has a solution Tha will be welcome
Let me know if you need more details


SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-11-13 : 09:19:14
Wow! That was... nothing but amazing!

No DDL, so sample data. No expected output, only logic to get output.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -