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 |
|
KabirPatel
Yak Posting Veteran
54 Posts |
Posted - 2007-06-15 : 12:08:23
|
| Hi,I have a table as follows:Job Country Role-----------------------------Job001 AU Role001Job001 AU Role002Job001 AU Role003Job001 BE Role001Job001 BE Role002Job001 BE Role004Job002 AU Role001Job002 BE Role001Job003 AU Role001Job003 AU Role002Job003 CH Role001Job003 CH Role002Job003 CH Role003The script for this is:CREATE TABLE [#JobRole]( [JobID] VARCHAR(50) ,[ImpCode] VARCHAR(50) ,[RoleNo] VARCHAR(50))INSERT INTO [#JobRole]SELECT 'Job001' , 'AU' , 'Role001'UNION ALLSELECT 'Job001' , 'AU' , 'Role002'UNION ALLSELECT 'Job001' , 'AU' , 'Role003'UNION ALLSELECT 'Job001' , 'BE' , 'Role001'UNION ALLSELECT 'Job001' , 'BE' , 'Role002'UNION ALLSELECT 'Job001' , 'BE' , 'Role004'UNION ALLSELECT 'Job002' , 'AU' , 'Role001'UNION ALLSELECT 'Job002' , 'BE' , 'Role001'UNION ALLSELECT 'Job003' , 'AU' , 'Role001'UNION ALLSELECT 'Job003' , 'AU' , 'Role002'UNION ALLSELECT 'Job003' , 'CH' , 'Role001'UNION ALLSELECT 'Job003' , 'CH' , 'Role002'UNION ALLSELECT 'Job003' , 'CH' , 'Role003'I want a listing of all Jobs that differ in their role list for each country.So, in the above example I would want Job001 to be output as the Roles differ for AU and BE.I would not want Job002 to be output as it has the same roles for AU and BE.I would also want Job003 to come out as the Roles vary for AU and CH.Their could be any number of Countries per Job. All I am interested in is whether their are any differences.Thanks in advance,Kabir |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2007-06-15 : 14:05:13
|
| What about this data:Job004, CH, Role001Job004, AU, Role002Does that job get returned or not?- Jeffhttp://weblogs.sqlteam.com/JeffS |
 |
|
|
KabirPatel
Yak Posting Veteran
54 Posts |
Posted - 2007-06-25 : 05:47:16
|
| Sorry for the delay (I have been on holiday). Yes, that should come out aswell.Cheers,Kabir |
 |
|
|
|
|
|
|
|