sql - want to filter out following mysql resultset further -


i getting record follows : provider_id location_id | service_id

21 | 42 | 387

32 | 42 | 387

23 | 42 | 397

45 | 42 | 397

25 | 42 | 700

25 | 53 | 397

27 | 53 | 700

i want filter out further follows. made query service_id 387,397 , 700 , getting record per that.

but want each location 3 service_ids 387, 397 , 700 has there. getting locations 1 or 2 service_ids. want filter out these records. locations support 3 services search has made.

also record has multiple provider working on (same or different) location services.

the following query think want:

select location, count(distinct serviceid) numserviceids t serviceid in (387, 397, 700) having count(distinct serviceid) = 3 

it selects service ids looking for. groups them location, counting number of service ids @ each location, , returning ones have three.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -