Hi all..
Latest adventure in SQL is for a client who has a list of offices and
locations etc...

I've this query:

==============

SELECT company.company_id,
        company.company_name,
        company.website,
        location.location_name,
        COUNT(location.location_name) AS COUNT_location_name
        FROM premises
                INNER JOIN company ON premises.company_id = company.company_id
                INNER JOIN location ON premises.location_id = 
location.location_id
        WHERE
                premises.status = 1
        GROUP BY company.company_id, company.company_name, company.website
        ORDER BY company.company_name ASC

==============
The out put of which is:

Company x - 2 offices
Company y - 4 offices
Company z - 1 Office

BUT the client wants:

Company x - 1 Office - London
Company x - 1 Office - Paris
Company y - 1 Office - London
Company y - 2 Office - Paris
Company y - 1 Office - Rome
Company z - 1 Office - London

Can I do this in one query?
:-(

____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
      Send Your Posts To: wdvltalk@lists.wdvl.com
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

________________  http://www.wdvl.com  _______________________

You are currently subscribed to wdvltalk as: archive@jab.org
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.

Reply via email to