count, having


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: count, having

  1. #1
    sheryl kemp Guest

    count, having



    Hi, I have a table where I need to extract fields with multiple values.
    example: In my table I have multiple Customerid's with multiple orderid's

    I need to see customerid's with the same orderid appearing 4 times or more.

    (Customerid's having a count of the same orderid more than 4 times.)

    I hope this makes sense, kinda hard to explain.
    Thanks

  2. #2
    Jason Rein Guest

    Re: count, having


    "sheryl kemp" <sheryl.kemp@wachoiva.com> wrote:
    >
    >
    >Hi, I have a table where I need to extract fields with multiple values.
    >example: In my table I have multiple Customerid's with multiple orderid's
    >
    >I need to see customerid's with the same orderid appearing 4 times or more.
    >
    >(Customerid's having a count of the same orderid more than 4 times.)
    >
    >I hope this makes sense, kinda hard to explain.
    >Thanks


    Try this:

    Select
    CustomerID,
    Count(OrderID)
    From
    Table1
    Group By
    CustomerID
    Having Count(OrderID) > 4


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
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center