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.
Author |
Topic |
rcchowdhary
Starting Member
3 Posts |
Posted - 2005-08-26 : 05:33:38
|
Hi I have stucked up with writing stored procedure to get the desired output.would appreciate help in from you alli would like to get the intersection,union and set of records based on the TypeHere is the data in my tableResourceclasses-------------------ResourceClassId Name Type-----------------------------------------------1 Resource Classes 62 All Resources 53 Set1 54 List of Resource 55 Union 66 Intersect 77 Intersection 78 Union1 6Type 5:Set of Resource classes Type 6:Union of Resource classesType 7:Intersection of Resource classesResourceclassMembers----------------------ResourceClassId SubclassId ResourceId-------------------------------------------3 0 10113 0 10013 0 10154 0 10014 0 10094 0 10045 4 05 3 06 4 06 5 07 3 07 6 07 4 07 5 08 3 08 7 0Desired OutputResourceClassId ResourceId3 10113 10013 1015---------------------------5 10115 10015 10155 10095 1004-------------------------------6 10016 10096 1004-----------------------------Each ResourceclassId in the Resourceclass Table belongs to a Type which is either(5-Set,6-Union,7-Intersection)which is linked to ResourceClassmembers tableIf you look at the ResourceClasses tableResourceClassId 5 is made up of (Union of)two resourceclasses 3 and 4so the output for ResourceclassId 5 is5 10115 10015 10155 10095 1004where as the ResourceclasId 3 is of type(Set)which has no Subclasses so we return ResourceId for them.3 10113 10013 1015simillarly it is same with ResourceClassId 6(of type Intersection)is made up of two classes4 and 5 Hope i was able to explain my problem clearly..Apologise if any thing wrong with my explanationThanks |
|
coolerbob
Aged Yak Warrior
841 Posts |
Posted - 2005-08-26 : 07:05:37
|
show us what u have tried and what is wrong with it |
|
|
rcchowdhary
Starting Member
3 Posts |
Posted - 2005-08-26 : 07:36:31
|
Thanks for the reply coolerbobI am trying the solution using lot of temporary tables and cursors.It just looking so awkward solution and it is getting difficult to even debug the sp'sWhat is the best way to solve this problem |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|