Having following variable $select where all necessary configurations are made and works fine. There is task for filtering data on same table like following:
For example table values with fields:
- id object_type object_value
- 1-----------8------------1
- 1-----------5------------300
- 2-----------8------------0
- 2-----------5------------500
- 3-----------8------------1
- 3-----------5------------400
- 4-----------8------------1
- 4-----------2------------10 ...
Values must be sorted like following:
- When object_type = 8 chose only object_value = 1
- AND
- When object_type = 5 chose only object_value >= 400 For example.
Tried using Zend_Db_selectunion() but that doesn't seem to work. Any ideas will be very helpfull. Also with joins doesn't seem to be an option.Couldn't implement case.
Update Applying query should sort data and output :
- id object_type object_value
- 3-----------8------------1
- 3-----------5------------400
Explanation For example id=1 has 2 rows
- object_type=8
- object_value=1
AND
- object_type=5
- object_value=300
Query checks if id with number when object_type = 8 the object_value must be = 1 and when object_type=5 then object_value must be >= 400 so in following case id with number 1 and it's values won't be displayed. Only id with number 3 matched searched query. Hope a little explanation made thinks clear if not i will add later experimental values on concrete objects.