On 2010-12-07 03:55, Anand Chitipothu wrote:
2010/12/7 King Huang<[email protected]>:
I have a view whose view keys are currently of the following form:

[k, x, y, z]
[k, x, y, 0]
[k, x, 0, z]
[k, x, 0, 0]
[k, 0, y, z]
[k, 0, y, 0]
[k, 0, 0, z]
[k, 0, 0, 0]

There are multiple values for k, x, y, and z, and x, y, z can be undefined 
(represented by 0 here).

What I want to be able to fetch are, given k, x, y, and z, all the view rows 
with (key and (x or 0) and (y or 0) and (z or 0)). I'm having difficultly 
coming up with an appropriate view key structure where the view rows will be 
sorted in a manner that allows me to select that. Does anyone have any 
suggestions?
You can do that in two ways.

1. Query for all possible combinations. [k, x, y, z], [k, x, y, 0],
[k, x, 0, z], [k, x, 0, 0], [k, 0, y, z], [k, 0, y,  0], [k, 0, 0, z],
[k, 0, 0, 0].

2. Query for k and write a list function that filters the required values.
I am doing this:

3. write a view for each of the columns (k, x, y, z), query each view and aggregate the results using set operations.

Regards,

Michael.

Reply via email to