Grouping records by subsets SQL
Posted
by Stacy
on Stack Overflow
See other posts from Stack Overflow
or by Stacy
Published on 2010-05-17T17:25:25Z
Indexed on
2010/05/17
17:30 UTC
Read the original article
Hit count: 215
sql
I have a database with PermitHolders (PermitNum = PK) and DetailedFacilities of each Permit Holder. In the tblPermitDetails table there are 2 columns
- PermitNum (foreign Key)
- FacilityID (integer Foreign Key Lookup to Facility table).
A permitee can have 1 - 29 items on their permit, e.i. Permit 50 can have a Boat Dock (FacID 4), a Paved walkway (FacID 17) a Retaining Wall (FacID 20) etc. I need an SQL filter/display whatever, ALL PERMIT #s that have ONLY FacIDs 19, 20, or 28, NOT ones that have those plus "x" others,....just that subset. I've worked on this for 4 days, would someone PLEASE help me? I HAVE posted to other BB but have not received any helpful suggestions.
© Stack Overflow or respective owner