Re: Another SELECTING problem :-(
| From: | Steve Brett | Date: | Thu, 09 Aug 2001 12:45:04 +0000 |
| Subject: | Re: Another SELECTING problem :-( | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-11180@lists.php.net to get a copy of this message | ||
"Dave Watkinson" <d.watkinson@mightymatch.com> wrote in message
news:7CB9A13377EBE542BA2C8146178E8C7B02A3CA@bigbertha.mmhome.co.uk...
PS This is for a web page, so it's PHP related!!! :-)
-----Original Message-----
From: Dave Watkinson
Sent: 09 August 2001 12:51
To: PHP-DB List (E-mail)
Subject: [PHP-DB] Another SELECTING problem :-(
I've a feeling I've asked this before, but checked my old messages and
couldn't see it in there for the excess of non PHP-Database questions
flying around (yep - that's a joke, but I've been here a while - forgive
me!).
I have (many many many) tables ... two of which are linked by a third,
so that there can be a one-to-many relationship.
>>>>three tables defines a many to many relationship.
>>>>a one to many is defined by posting a foreign key.
>>>>try it with 2 tables.
What I'd like to do is
find which ids from table 1 have more than one relation in table 2, via
table 3.
I've tried this...
select
empid, count(empid)
from
emp_cont , employers, contacts
where
emp_cont.empid = employers.uid
and
emp_cont.contid = contacts.uid
and
count(empid) > 1;
and get all kinds of invalid grouping messages
many TIA
Dave