PC Review


Reply
Thread Tools Rate Thread

Query for Parent containing only ONE type of child

 
 
Jamie Collins
Guest
Posts: n/a
 
      18th Jan 2008
On Jan 18, 3:41 pm, Jamie Collins <jamiecoll...@xsmail.com> wrote:
> > I believe he only wanted those companies that just have
> > Broker Associates and no other titles.

>
> Fair enough Add another test:


Oops! Posted to quick:

SELECT C1.CompanyName
FROM Company AS C1
WHERE EXISTS (
SELECT *
FROM Contact AS T1
WHERE C1.CompanyID = T1.CompanyID
AND T1.Title = 'Broker Associate')
AND 1 = (
SELECT COUNT(*)
FROM (
SELECT T1.Title, T1.CompanyID
FROM Contact AS T1
GROUP BY T1.Title, T1.CompanyID
) AS DT1
WHERE C1.CompanyID = DT1.CompanyID
);

Jamie.

--

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create DataSet schema with Parent table containing child table donet programmer Microsoft ASP .NET 1 5th Dec 2006 04:18 AM
passing data child parent parent child Maarten Microsoft C# .NET 3 21st Nov 2005 05:13 PM
is there an event that fires when a child control is added to a parent container control (ie child panel added to a parent panel)? notu Microsoft Dot NET Compact Framework 1 19th Jul 2005 07:34 PM
Sample Xmas letter Santa for Child that parent can print & parent. =?Utf-8?B?U2FudGEncyBIZWxwZXI=?= Microsoft Access 1 4th Feb 2005 06:30 PM
Parent/Child Components: How to make the child components go away when deleting the Parent. Patrick Vanden Driessche Microsoft VB .NET 5 14th Nov 2003 11:32 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:40 PM.