* Blaster
[...]
main company table
id (int) | company name (varchar) | phone (varchar) | .. more fields that
doesn't really matter
employee table (company.id = employee.cid)
id (int) | cid (int) | name (varchar) | age (int) | email (varchar)
Now, I want to make a search which can search
, 2003 7:51 AM
Subject: Re: A little problem with SELECT
* Blaster
[...]
main company table
id (int) | company name (varchar) | phone (varchar) | .. more fields
that
doesn't really matter
employee table (company.id = employee.cid)
id (int) | cid (int) | name (varchar) | age (int) | email
Marcos Henke Wrote:
SELECT a.* FROM company a, employee b
WHERE a.id=b.cid AND
(b.name='joe' OR
b.name='bill');
This will pull out all companies which have a Joe or a Bill. We want only the
company in which Joe and Bill are working.
A working solution was offered by Adolfo Bello earlier
Hello, I have a really tough problem here, I can't think of a way to make
this work
Imagine 2 tables, the first one is the main table where I keep listings
of companies and general info about them.
In the second table, I keep 1 row for each employee and an field which
points to the company
SELECT a.* FROM company a, employee b WHERE a.id=b.cid AND b.name='joe' OR
b.name='bill';
however, this would return any companies that has ONLY one Bill or one Joe
.. I only want companies that
have BOTH. It also returns one row with the company per name it found, so
you can imagine I