Query a queried dataset (joint dataset) in birt - birt

Can we query a joint dataset in birt which is a result of a query. If yes, how ?
For example, I have a joint dataset named "Data Set 1" result of two simple queries. Can we query this "Data Set 1" ?

You cannot query the result of a query (and a joint data set is a result of a join query).
However you can filter your results leading you to the same result like a query if you want to reduce your result set.

Related

Oracle query with "in clause" - how to speed up using an index?

I got a oracle query that uses an in-clause with eight given values, like:
select * from mytable a
where a.wf_type in ('value1', 'value2', 'value3', 'value4', 'value5', 'value6', 'value7', 'value8');
The table is not really big (about 3 million rows) and the query does a full table scan.
Therefore I added an index for the wf_type attribute.
But the index is not used by the query with the in-clause. If I change the query to one specific value like
select * from mytable a where a.wf_type = 'value1';
the index is used and the query runs fast.
How do I fasten the query with the in-clause? Is it possible by using an index or are there other ways?

Does the order of where conditions in hive queries has impact on the query performance?

I have the problem that my hive SQL queries sometimes result in an full-table scan and last very long. Thus I was wondering whether the order of the where statements really has an impact on the performance of queries.
E.g. the the query has a primary key build on date and secondary key differentiating objects. I'd like to only analyze yesterdays data, which should be much faster than an full table scan.
Query 1:
SELECT
primarykey,
COALESCE(SUM(param1),0L),
COALESCE(SUM(param2),0L),
param3
FROM
Table
WHERE
param1 = "abc" AND
param2 > 0 AND
primarykey = yesterdaysdate
GROUP BY
param3;
Query 2:
SELECT
primarykey,
COALESCE(SUM(param1),0L),
COALESCE(SUM(param2),0L),
param3
FROM
Table
WHERE
primarykey = yesterdaysdate AND
param1 = "abc" AND
param2 > 0
GROUP BY
param3;
Is it possible that query 2 is faster than query 1?
In my opinion this should not have any impact in reason of the query optimizer.
The hive queries internally execute as MR job. The where clause of the query should be treated as filtering criteria. So it should not have any impact over the performance.

SSRS - T-SQL - Concatenate multiple rows

I have T-SQL query that joins multiple tables. I am using that in SSRS as Dataset query. I am only selecting two columns, ID and Names. I have three records with same "ID" values but three different "Names" values. In SSRS, I am getting the first "Names" value and I need to concatonate all three values with same ID and have it in one cell on a table.
How would I go about doing that?
I am using lookup to combine cube + sql
Pulling ID straight from a table but using Case statement for Names to define alias.
You can accomplish this in TSQL either using PIVOT to get them as separate columns which you can then combine in the report cell, or you can use one of these concatenation methods to get all the names in one column.
For example, you can do this:
SELECT SomeTableA.Id,
STUFF(
(SELECT ',' + SomeTableB.Names AS [text()]
FROM SomeTable SomeTableB
WHERE SomeTableB.Id = SomeTableA.Id
FOR XML PATH('')), 1, 1, '' )
AS ConcatenatedNames
FROM SomeTable SomeTableA
INNER JOIN AnotherTable
ON SomeTableA.Id = AnotherTable.SomeId
...

Oracle Text multi column index based query does not return any rows

I have a MAH_KERESES_MV table with 3 columns OBJEKTUM_NEV, KERESES_SZOVEG_1, KERESES_SZOVEG_2. I create the following multi column Oracle Text index:
exec ctx_ddl.create_preference( 'MAH_SEARCH', 'MULTI_COLUMN_DATASTORE');
exec ctx_ddl.set_attribute('MAH_SEARCH', 'COLUMNS', 'OBJEKTUM_NEV, KERESES_SZOVEG_1, KERESES_SZOVEG_2');
create index MAX_KERES_CTX on MAH_KERESES_MV(OBJEKTUM_NEV)
indextype is ctxsys.context
parameters ('DATASTORE MAH_SEARCH');
But the query does not return any rows, although if I formulate the query with the like operator, then I get the results as expected:
SELECT id, OBJEKTUM_NEV
FROM MAH_KERESES_MV
WHERE CONTAINS(OBJEKTUM_NEV, 'C')>0;
Can some body please help? TIA,
Tamas
Just in case any body might be interested later on, the solution was that the above CONTAINS clause filters for the C character as a stand alone entity (i.e. word). The correct where clause would have been:
WHERE CONTAINS(OBJEKTUM_NEV, 'C%')>0;

MDX Replace Range With Filter

While looking at the following answer I wanted to replace the range with a filter.
MDX - Concurrent calculations based on a "record time range"?
The MDX is:
with member [Measures].[TotalUsed] as sum({[Date].[YQM].&[20090501]:[Date].[YQM].&[20090907]}, [Measures].[Used])
select {[Measures].[Total Used]}on columns,
{[Color].[Colors].[All].MEMBERS}on rows
from [Cube]
I'm trying to replace the Date range with a filter like this:
with member [Measures].[TotalUsed] as sum(FILTER([Date].[YQM], [Date].[YQM] < [Date].[YQM].&[20090907]), [Measures].[Used])
select {[Measures].[Total Used]}oncolumns,
{[Color].[Colors].[All].MEMBERS}on rows
from [Cube]
What is the conditional statement looking for in terms of comparing values? Any Help would be great!
Thanks!
The Filter statement needs a SET and then an EXPRESSION to filter on. You can drop this right inside your SUM function. The expression part of the filter can be almost anything, but it has to evaulate to true/false for each cell in the SET.
-- FILTER ( SET, EXPRESSION)
It's a bit tough not knowing what your data is structured like but your statment would probably end up like the following, filtering rows with less than 50 'UnUsed' for your timeperiods, and then summing them as an example.
`
WITH MEMBER [Measures].[TotalUsed]
AS SUM (FILTER ( [Date].[YQM].members, [Measures].[UnUsed] > 50 ),
[Measures].[Used] )
SELECT {[Measures].[Total Used]} ON COLUMNS,
{[Color].[Colors].[All].MEMBERS} ON ROWS
FROM [Cube]

Resources