MIN(Count(*))

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • medpeek
    New Member
    • Jun 2006
    • 1

    MIN(Count(*))

    Hi Guys,

    I am very new to SQL..i was trying out some queries..but got stuck here..
    I am trying to get least value from a result set. Basically i have to get min value of count(*) .. how do i do that without using TOP query?..

    Any ideas would be appreciated.

    Thanks
    shu
  • Egypt_81
    New Member
    • Jul 2006
    • 25

    #2
    get least value from a result set. Basically i have to get min value of count(*)

    what do u mean by getting the min value of count(*) ?!
    count(*) function returns the number of records table contains. so it's only one value !
    and MIN function returns the lowest value in all records !
    so logicaly u can't use both.
    May be I missunderstand u, tell me if u mean something else plz

    Best wishes
    Hesham el ebrashy

    Comment

    • sashi
      Recognized Expert Top Contributor
      • Jun 2006
      • 1749

      #3
      Hi there,

      below are sample SQL statement.. hope it helps you to get started.. good luck my fren.. :)

      The COUNT(*) function returns the number of selected rows in a selection
      Code:
      SELECT COUNT(*) FROM table
      The COUNT(column) function returns the number of rows without a NULL value in the specified column
      Code:
      SELECT COUNT(column) FROM table
      The MAX function returns the highest value in a column. NULL values are not included in the calculation
      Code:
      SELECT MAX(column) FROM table
      The MIN function returns the lowest value in a column. NULL values are not included in the calculation
      Code:
      SELECT MIN(column) FROM table

      Comment

      Working...