cubes
cubes copied to clipboard
Cut string to generate sql statement that contains OR clause on different columns
Hello everyone,
I read in the documentation that we can use cut string like: ...?cut=a:1|b:2 to generate sql statements that contains "where a=1 and b=2"
And we can use ; like this: ...?cut=a:1;2 to generate sql statements that contains "where a=1 or a=2"
How can I write a cut string that would generate sql like this? SELECT x, y, z FROM A LEFT JOIN B ON A.id = B.idOfA WHERE B.someColumn = 'something' OR B.someOtherColum = 'something else';
As we can see the where clause is concerned about 2 different columns, I have not found a way to do this in the doc.
Is this achievable?
Hi, is there a solution for this?
You would need to do this in two separate queries, and combine the results.
OLAP queries are not normally well suited for this: once you add the possibility that a single fact is selected by two different criteria, the behavior of aggregates is not well defined.
Perhaps there's other way of doing what you want. What is your use case exactly?
Hello @jjmontesl
I'm also interested in making queries using the OR clause.
Could you explain the reason you gave? I have tried to find documentation about it and I have not found any information that discourages the use of OR in OLAP.
Thanks in advance.
In version 1.1 it supports this feature. Syntax is just what @cuipengfei has suggested.