Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2012
    Posts
    1

    Post Unanswered: count with condition

    select count(*)<=1 from queue where qu-id='A003924'.

    queue is name of the table. qu-id is field name.

    EXisting:
    the output of this query is yes.

    Expected.
    --------
    if count (*)<=1. i do not want boolean value instead i want the count.

    please help me.!!!

  2. #2
    Join Date
    Nov 2003
    Posts
    2,934
    Provided Answers: 12
    I am not sure if I understand your question, but it sounds like you want:

    Code:
    select count(*)
    from queue 
    where qu-id='A003924'
    having count(*) <= 1
    Please use [code] tags in the future to format your SQL statements
    I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags: http://www.dbforums.com/misc.php?do=bbcode#code

    Tips for good questions:

    http://tkyte.blogspot.de/2005/06/how...questions.html
    http://wiki.postgresql.org/wiki/SlowQueryQuestions
    http://catb.org/esr/faqs/smart-questions.html

Tags for this Thread

Posting Permissions

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