NYCPHP Meetup

NYPHP.org

[nycphp-talk] SQL Select

Brian Dailey bdailey at jaysec.com
Tue Oct 17 12:32:09 EDT 2006


I assume you're using MySQL?

select count(ID), COUNTRY from tablename group by country;

Hope that helps!
- B. D.

Date: Mon, 16 Oct 2006 14:05:38 -0400
From: "Peter Sawczynec" <ps at pswebcode.com>
Subject: [nycphp-talk] SQL Select
To: "'Org, Talk at Nyphp.'" <talk at lists.nyphp.org>
Message-ID: <002f01c6f14d$af891410$6701a8c0 at SUNCODE1>
Content-Type: text/plain; charset="iso-8859-1"

If I have a table with fields roughly like:

ID NAME ADDRESS CITY STATE COUNTRY

I would like to do a select that would give me output grouped like so
(including the quantity):

United States (1589)
    New York (1200)
    Los Angeles (200)
    Dallas (189)
Maldives (1)
France (123)
    Paris (111)
    Bordeaux (9)
    Orleans (3)

etc.

Thanks in advance if you've got this at your fingertips.


Warmest regards,

Peter Sawczynec
Technology Director
PSWebcode
_Design & Interface
_Ecommerce
_Database Management
646.316.3678
ps at pswebcode.com
www.pswebcode.com <http://www.pswebcode.com/>



More information about the talk mailing list