Count of records inside the records but based on distinct?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Alo
    New Member
    • Aug 2006
    • 2

    Count of records inside the records but based on distinct?

    I need help. I have a table that I need 7 things from.

    So I have a table that i'm retrieving RecordID, UserDate, Ticket#, Description, EnterDate, Area, and Type from (not the real names, but it doesn't matter.

    Here's the problem. I need to retrieve records where there are 3+ instances of type that are the same in an area, and then those three+ corresponding ticket# fields should each be different. So it could be like

    Type Ticket# Area
    Computer 1b MN
    Computer 1c MN
    Computer 1c LA
    Computer 1e MN
    Computer 1a LA
    Laptop NULL GE
    Laptop 2b TI
    Laptop 2b TI
    Laptop 1a UT
    Monitor 3g NV
    Monitor 3p NV
    Monitor 3m NV

    etc. Of this, I would want a result that returned
    Type Ticket# Area
    Computer 1b MN
    Computer 1c MN
    Computer 1e MN
    Monitor 3g NV
    Monitor 3p NV
    Monitor 3m NV

    Because they were the only ones with three unique ticket# fields for 3+ possible Type's of the same type.

    On top of that, I need to display the corresponding information of RecordID, UserDate, Description, EnterDate, and Area for each record.

    I believe the closest thing I can do with it involves a self join for ticket# and Type, but so far, for the life of me, i can't figure out how to make sure that there are at least 3 listed (in the area) and that the three types are different. Anyone?
Working...