Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select
- user_pub_id
- from
- identity_custom_fields_values as icfv
- inner join identity_custom_fields_defenitions as icfd on icfd.pub_id = icfv.defenition_pub_id
- inner join identity_host as ih on ih.aid = icfd.aid
- where
- icfd.aid = "aid" and
- (icfv.pub_id = 'fieldId1' and icfv.value = 'value1') or
- (icfv.pub_id = 'fieldId2' and icfv.value like 'value2') or
- (icfv.pub_id = 'fieldId3' and icfv.value between cast('2016-01-29' as DATE) and cast('2017-01-29' as DATE)) or
- (icfv.pub_id = 'fieldId4' and icfv.value in ('value3','value4')) or
- (icfv.pub_id = 'fieldId5' and icfv.value between 100 and 200 )
- group by
- user_pub_id
- having
- count(distinct icfv.pub_id) = 5
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement