Thread: Special Count

    #1
  1. No Profile Picture
    vdschoor
    Guest
    Devshed Newbie (0 - 499 posts)
    I want to get the following result on a webpage :

    Date Name type1 type2 type3
    1999/11/10 joe 10 2 6

    But my in my table they are stored like this :

    1999/11/10 joe type1
    1999/11/10 joe type2
    1999/11/10 joe type1
    1999/11/10 joe type3
    1999/11/10 joe type1

    Can anyone help me with the right query?
    I know in MS Access you can do this with :
    count(IIF(type=type1),1,0)

    Is there a function like this for MySQL?
  2. #2
  3. No Profile Picture
    vdschoor
    Guest
    Devshed Newbie (0 - 499 posts)
    I found it myself (finally)
    The way to go is :

    Select date,count(IF(type='Normal',1,0))..
    . group by date;

    Thanks!

Similar Threads

  1. FEB Reseller *SUPER* Special! @ UnitHosting.net!
    By UnitHosting in forum Web Hosting Offers
    Replies: 0
    Last Post: February 8th, 2004, 06:51 PM
  2. FEB Reseller *SUPER* Special! @ UnitHosting.net!
    By UnitHosting in forum Web Hosting Offers
    Replies: 0
    Last Post: January 30th, 2004, 10:06 PM
  3. How to count max appearances?
    By Stew_McGruff in forum MySQL Help
    Replies: 8
    Last Post: December 13th, 2003, 06:27 PM
  4. words count in a sentence
    By alebaba in forum C Programming
    Replies: 5
    Last Post: November 22nd, 2003, 09:54 AM
  5. Dealing with special characters in forms
    By michaelcaplan in forum HTML Programming
    Replies: 1
    Last Post: January 4th, 2003, 03:37 PM

IMN logo majestic logo threadwatch logo seochat tools logo