L
Logitech
Also posted in : microsoft.public.sqlserver.programming
Hi,
I'm not very experienced with creating queries and am having some difficulty
creating what I want. I was hoping someone could help me?
In layman's terms, here is what I am trying to create:
"Select all contacts where there is only one contact per company".
The code I tried was:
TABLES
account (i.e. company)
contact
-------------------------
SELECT *
FROM contact
WHERE (SELECT Count(*)
FROM contact JOIN account ON
(contact.accountid = account.accountid)
) = 1
However, this doesn't return anything. Help!
Thanks,
Darren
Hi,
I'm not very experienced with creating queries and am having some difficulty
creating what I want. I was hoping someone could help me?
In layman's terms, here is what I am trying to create:
"Select all contacts where there is only one contact per company".
The code I tried was:
TABLES
account (i.e. company)
contact
-------------------------
SELECT *
FROM contact
WHERE (SELECT Count(*)
FROM contact JOIN account ON
(contact.accountid = account.accountid)
) = 1
However, this doesn't return anything. Help!
Thanks,
Darren