Databases

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • Count and list only where count is bigger than 1

    2 answers - 350 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Hi list,
    It is possible to make a count select and only display where count column is
    bigger than 1 ?
    My SQL is like this
    SELECT distinct cli.bairro, ****( * ) as qtd
    FRM base.cliente cli
    GRUP BY cli.cidade, cli.bairro
    RDER BY 2
    I noticed that I cannot use "where qtd 1" ok ?
    What to do ?
    Regards
  • No.1 | | 541 bytes | |

    Hi list,

    It is possible to make a count select and only display where count column
    is
    bigger than 1 ?

    My SQL is like this

    SELECT distinct cli.bairro, ****( * ) as qtd
    FRM base.cliente cli
    GRUP BY cli.cidade, cli.bairro
    RDER BY 2

    I noticed that I cannot use "where qtd 1" ok ?

    SELECT distinct cli.bairro, ****( * ) as qtd
    FRM base.cliente cli
    GRUP BY cli.cidade, cli.bairro
    HAVING count(*) 1;

    (end of broadcast)
    TIP 3: Have you checked our extensive FAQ?

  • No.2 | | 607 bytes | |

    am Tue, dem 19.09.2006, um 12:04:55 -0300 mailte Ezequias Rodrigues da Rocha folgendes:
    Hi list,

    It is possible to make a count select and only display where count column is
    bigger than 1 ?

    My SQL is like this

    SELECT distinct cli.bairro, ****( * ) as qtd
    FRM base.cliente cli
    GRUP BY cli.cidade, cli.bairro
    RDER BY 2

    I noticed that I cannot use "where qtd 1" ok ?

    What to do ?

    HAVING.

    17:14 < akretschmer?having
    17:14 < pg_docbot_adsFor information about 'having' see:
    17:14 < pg_docbot_ads#QUERIES-GRUP

    Andreas

Re: Count and list only where count is bigger than 1


max 4000 letters.
Your nickname that display:
In order to stop the spam: 7 + 7 =
QUESTION ON "Databases"

EMSDN.COM