Expand|Select|Wrap|Line Numbers
- SELECT DISTINCT servicesid,short_name, long_name
- FROM tg_services
- WHERE servicesid IN
- (SELECT DISTINCT service_id FROM tg_srv_links
- WHERE service_id IN
- (SELECT DISTINCT service_id
- FROM tg_srv_links
- WHERE option_id = 9) AND option_id = 40 AND option_id = 27 AND option_id = 3)
- AND s_approved=1
- AND long_name <> ''
- ORDER BY `long_name`
- LIMIT 0, 5
Expand|Select|Wrap|Line Numbers
- option_id = 40 AND option_id = 27 AND option_id = 3
Expand|Select|Wrap|Line Numbers
- row_id | service_id | option_id
- -----------------------------------------------
- 3 | 9 | 40
- -----------------------------------------------
- 4 | 9 | 27
- -----------------------------------------------
- 5 | 9 | 3
- -----------------------------------------------
- 6 | 6 | 40
- -----------------------------------------------
- 7 | 6 | 27
- -----------------------------------------------
- 8 | 6 | 22
- -----------------------------------------------
- 9 | 24 | 10
- -----------------------------------------------
- 10 | 24 | 27
- -----------------------------------------------
- 11 | 24 | 40
- -----------------------------------------------
- 12 | 24 | 3
In the table example above, the query should return 9 and 24 for the service_id's, since 9 and 24 both contain option_id's with 40, 27 and 3
anyone have any suggestions how to proceed?