question

thennarasu avatar image
thennarasu asked

single entry in company

DirectorID	Name	Company Name
999595	       Glover	Simpson 
999595	      Glover	Clifford 
1092897	      Lesser	Simpson
1092924	       Spatt	Simpson 
1111968	      Rubinsky	Simpson 
1111968	      Rubinsky	Willkie 
this is the table director detail and company details from two diff table director id is primary key i want the director list who have worked single company my out pot like as follow
DirectorID	Name	Company Name 
1092897	      Lesser	Simpson
1092924	       Spatt	Simpson
sqlsql-server-2012
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Kev Riley avatar image Kev Riley ♦♦ commented ·
If the first data set is a result over 2 tables (director and company) - what are the underlying table definitions? Is there a link table that resolves the many-to-many relationship
0 Likes 0 ·

1 Answer

·
Gazz avatar image
Gazz answered
so firstly you have to find which DirectorIDs only appear once: SELECT DirectorID FROM TABLE GROUP BY DirectorID HAVING COUNT(*) = 1 The rest is simple, so I will let you finish it
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.