SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: count

  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2008
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    count

    Hi,

    Below I got the output. I wish to count product id.
    i.e
    product id->66 occurs 2 times.
    product id->7 occurs 1 time.
    any query for this?

    Code PHP:
    product id-->7
    product id-->66
    product id-->66
    product id-->78
    product id-->58
    product id-->6
    product id-->8

  2. #2
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,805
    Mentioned
    157 Post(s)
    Tagged
    3 Thread(s)
    Is it a string? an array? or do you need an sql query?
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  3. #3
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Assuming this is a database question accidently posted in the php forum
    Code:
    SELECT id
         , COUNT(*)
      FROM sometable
    GROUP
        BY id


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •