www.webdeveloper.com
Results 1 to 3 of 3

Thread: mysql count query

  1. #1
    Join Date
    Mar 2006
    Location
    mumbai, india
    Posts
    17

    mysql count query

    hi
    i have 2 table with some 100 entries, of which some say 70 entries have images in them, these images r stored in different table
    is it possible to get result like

    image 70 30

    in a single query???

    i am running query like

    SELECT imagetype.image_type, count( docs.ids ) AS 'Image_present' FROM docs, imagetype WHERE docs.ids = imagetype.id AND imagetype.image_type = "Image1" GROUP BY imagetype.image_type

    and i am getting result as

    image1 70

    now i want the count without images it's 30 here, what to add in the query??
    thanx in advance
    Last edited by gayatri; 03-21-2006 at 04:46 AM.

  2. #2
    Join Date
    Aug 2005
    Location
    The Garden State
    Posts
    5,634
    You can't!
    You need to make it separate.
    Acceptable Use | SQL Forum FAQ | celery is tasteless | twitter

    celery is tasteless - currently needing some UI time

  3. #3
    Join Date
    Mar 2006
    Location
    mumbai, india
    Posts
    17

    thanx

    ya i have done it with 2 queries now
    but i just wish there could have been a single query, my code would have looked a little good than now
    thanx for reply
    GaYaTrI

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles