#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Location
    Denmark
    Posts
    7
    Rep Power
    0
    I am working on a little project, I need to make some lookups in a MySQL table.

    Table:

    ID name type
    1 John a
    2 Martin a
    3 Winston c
    4 Mark b
    5 Bill b

    I then need to make a list of which types there are. EG:

    Types:
    a
    b
    c

    And I also need to make a count of how many of each type there are EG:

    Type Count
    a 2
    b 2
    c 1

    I am using PHP3 to interface the MySQL db, how can I do this?

    --
    Anders
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 1999
    Location
    Annapolis, Maryland US
    Posts
    113
    Rep Power
    16

    select distinct(type) from table_name;
    select type, count(type) from table_name group by type;

Similar Threads

  1. problem: asp files, from access to mysql
    By karib1 in forum MySQL Help
    Replies: 1
    Last Post: November 26th, 2003, 04:16 AM
  2. Can't connect to MySQL server remotely
    By bper in forum MySQL Help
    Replies: 2
    Last Post: October 2nd, 2003, 03:09 PM
  3. Errcode:13 . How to solve it on MySQL + Windows 2000
    By hankycheng in forum MySQL Help
    Replies: 28
    Last Post: August 3rd, 2003, 11:05 AM
  4. ODBC mySQL Connection Problem
    By kjedwards in forum MySQL Help
    Replies: 1
    Last Post: October 7th, 2001, 04:50 PM

IMN logo majestic logo threadwatch logo seochat tools logo