Hi.
IMHO, the self-join is the correct solution for the given table layout
(which looks reasonable to me).
Greetings,
Benjamin.
On Wed 2002-07-17 at 09:26:48 +0530, [EMAIL PROTECTED] wrote:
[...]
> > Select companyid, count(*) from CompanyServices where
> > serviceid = 1 or serviceid
MAIL PROTECTED]>; "MySQL"
> <[EMAIL PROTECTED]>
> Cc: "Arul" <[EMAIL PROTECTED]>
> Sent: Wednesday, July 17, 2002 3:27 AM
> Subject: Re: help me with this query
>
>
> > Hi,
> >
> > Select companyid, count(*) from CompanyServices
"MySQL" <[EMAIL PROTECTED]>
Cc: "Arul" <[EMAIL PROTECTED]>
Sent: Wednesday, July 17, 2002 3:27 AM
Subject: Re: help me with this query
> Hi,
>
> Select companyid, count(*) from CompanyServices where
> serviceid = 1 or serviceid = 2 or serviceid = 3
>
Hi,
Select companyid, count(*) from CompanyServices where
serviceid = 1 or serviceid = 2 or serviceid = 3
group by companyid
having count(*) = 3
Bye and Good Luck.
--- Arul <[EMAIL PROTECTED]> wrote:
> Hi All
>
> The Table design goes like this
>
> Company Table
>
> companyid
Hi All
The Table design goes like this
Company Table
companyid integer
name varchar(100)
Services Table
ServiceIDinteger
Servicevarchar(50)
Company Services
---
companyidinteger - References Company(companyid
Hi All
The Table design goes like this
Company Table
companyid integer
name varchar(100)
Services Table
ServiceIDinteger
Servicevarchar(50)
Company Services
---
companyidinteger - References Company(companyid
select u.userid , c.companyname from
users u left join company c on (u.companyid = c.companyid)
where u.status = 'ACT'
Best regards,
Mikhail.
- Original Message -
From: "Arul" <[EMAIL PROTECTED]>
To: "MySQL" <[EMAIL PROTECTED]>
Sent: Tuesday, J
Hi All
I have two tables User and Company
User tables has userid , companyid and status
Company table has companyid and companyname
It's not necessary that all users should have company.There can be users
without company also and for them the companyid is null.
so i need all the users whose st