Discoverer columns from two different sheets
Hi,
Is it possible in discoverer to bring columns from a different sheet into another sheet? I have a few columns on sheet2, which have a different condition and sheet1 has different conditions. The sheets 1 and 2 can be linked on their emplid. Is there a way to combine the columns??
Any help is greatly appreciated.
Thanks!
Hi,
I am using decode to try and get the column with the condition into the first sheet.
For example:
In my first sheet, I select emplid, empl_no, area_cde, avg_eqty from table a.
I also want the following from table a:
1) count rec_id where a_cde in (1,2,3)
2) count rec_id where a_cde in (1,2,3) and product_cde = 1 and discnt = 1
When I use decode, and select the columns, I say,
calc1:
decode(a_cde,1,1,2,1,3,1) --> seperating a codes 1,2,3 and the rest of them.
calc2:
and then I calculate another item --> case when calc1 = 1 then count(rec_id) else NULL end
When I do the above, I get one row as expected.
However, when I try to incorporate 2), I created another calculation:
calc3:
case when calc1 = 1 and product_cde = 1 and discnt = 1 then count(rec_id)
As soon as I add this calc to my report, I get 2 rows returned, because, the Avg_discnt column (just the col selected from the table, not a calc), has a discnt = 1 associated with it, and I get two rows instead of one row.
Please let me know if posting the SQL generated by discoverer would be more clearer.
Thanks for your inputs!
Edited by: spriya on Apr 6, 2010 2:16 PM
Similar Messages
-
How to Create a new column from two different result sets
How to Create a new column from two different result sets, both the result set uses the different date dimensions.
i got solutions for this is apply filters in column formula it self, based on the requirement.
-
Concatenate columns from two different reports
In OBIEE 11g report, I am looking for a method to concatenate columns from two different reports.
My requirement is, if I show 'Units Produced' for customer A, I need to show another column 'Units Produced' for a related customer B.
Every customer has one related customer.
So my report shows all the data for customer A, but I need to add one column which is for custome B , so I am looking a way to concatenate columns or if some other way this can be doneCustomer A is dimension table. You mapped to fact to get Customer A details.
Now you want for Customer B. Now create one more alias table for Customer and name it as customer B and join with Fact on Customer B keys and use it.
Each customer has related customer.
2 dimension tables one for customer and other for related customer. -
Sum two different columns from two different tables
Can you select and sum two different columns, from two different tables in the same sql statement?
i.e.
table1
Item----OnHand_Qty
A--------10
A--------15
B--------10
B--------10
C--------20
table2
Item----Trx_Qty
A--------2
A--------4
A--------6
B--------1
B--------1
C--------4
I'm looking for the following results from a query
Item----Sum(Onhand_Qty)---Sum(Trx_Qty)
A--------25Like this?
SQL> create table table1 (item,onhand_qty)
2 as
3 select 'A', 10 from dual union all
4 select 'A', 15 from dual union all
5 select 'B', 10 from dual union all
6 select 'B', 10 from dual union all
7 select 'C', 20 from dual union all
8 select 'D', 30 from dual
9 /
Tabel is aangemaakt.
SQL> create table table2 (item, trx_qty)
2 as
3 select 'A', 2 from dual union all
4 select 'A', 4 from dual union all
5 select 'A', 6 from dual union all
6 select 'B', 1 from dual union all
7 select 'B', 1 from dual union all
8 select 'C', 4 from dual union all
9 select 'E', 3 from dual
10 /
Tabel is aangemaakt.
SQL> select nvl(t1.item,t2.item) item
2 , t1.sum_onhand_qty
3 , t2.sum_trx_qty
4 from ( select item, sum(onhand_qty) sum_onhand_qty
5 from table1
6 group by item
7 ) t1
8 full outer join
9 ( select item, sum(trx_qty) sum_trx_qty
10 from table2
11 group by item
12 ) t2
13 on (t1.item = t2.item)
14 /
I SUM_ONHAND_QTY SUM_TRX_QTY
A 25 12
B 20 2
C 20 4
E 3
D 30
5 rijen zijn geselecteerd.Regards,
Rob. -
Contatenation of columns from two different tables
Hi everyone
i have one table in following desc
table-1
str q4_currrent Q4_target
prd 500 1000
Table-2
q3_currrent Q4_target
345 1000
Table-3
percentage
50
I want the result in this format---
str q4_currrent Q4_target q3_currrent Q4_target percentage
prd 500 1000 345 1000 50
Can anyone help me how can i get this result? I want this to be done only with
query not with any procedure or function.
if you hav any query to concatenate the different tables please suggest.
thanks.
-Anandhi
thw solution which you have given that is giving the
cartesian product of all the rows of the all the 3
tables.
1st table-7 rows
2nd table-7 rows
3rd table-7 rows
total rows in result table- 343 rows.
So its not working well..
thanks for ur response.What part of
You might also want a WHERE clause if the tables have more than one row in.did you have a problem with? You provided no information on which any of us could have written a join condition. I assumed you either had only the one row you showed us, or you were planning on coding the join yourself. -
Getting DISTINCT count from two different columns
Hi all,
I have following query which gives currency code from two different tables. I would like to get the distinct count of currency codes from these two different columns.
SELECT eb.person_seq_id, eb.bonus_amount, eb.currency_cd, ed.currency_cd_host
FROM fr_emp_bonuses eb, fr_emp_details ed, fr_periods p
WHERE eb.person_seq_id = ed.person_seq_id AND ed.period_seq_id = eb.period_seq_id
AND ed.period_seq_id = p.period_seq_id AND p.period_status = 'CURRENT'
AND eb.bonus_amount >= 0 AND eb.person_seq_id = 3525125;
This query gives following result
3525125 240000 USD INR
3525125 0 USD INR
3525125 60000 USD INR
3525125 50000 USD INR
There are two distinct currency codes (USD, INR) and total amount is 350000. So I am looking for a query to give me the following result
3525125 350000 2
Thanks in advanceHi,
Here's one way:
WITH original_query AS
SELECT eb.person_seq_id
, eb.bonus_amount
, eb.currency_cd
, ed.currency_cd_host
FROM fr_emp_bonuses eb
, fr_emp_details ed
, fr_periods p
WHERE eb.person_seq_id = ed.person_seq_id
AND ed.period_seq_id = eb.period_seq_id
AND ed.period_seq_id = p.period_seq_id
AND p.period_status = 'CURRENT'
AND eb.bonus_amount >= 0
AND eb.person_seq_id = 3525125
, unpivoted_data AS
SELECT person_seq_id
, bonus_amount
, currency_cd
FROM original_query
UNION ALL
SELECT person_seq_id
, 0 AS bonus_amount
, currency_cd_host AS currency_cd
FROM original_query
SELECT person_seq_id
, SUM (bonus_amount) AS total_bonus_amount
, COUNT (DISTINCT currency_cd) AS distinct_currency_cds
FROM unpivoted_data
GROUP BY person_seq_id
;There may be a shorter, more efficient way to get the same results, but without knowing more about your tables, I can't tell.
The tricky thing is getting two columns (currency_cd and currencuy_cd_host in this case) counted together. You can't simply say
COUNT (DISTINCT eb.currency_cd) +
COUNT (DISTINCT ed.currency_code_host)That happens to get the correct result with the sample data you posted, but what if you had data like thEe following?
currency_cd currency_cd_host
INR USD
USD INRHere, the count of distinct currency_cds is 2, and the count of distinct currency_cd_hsots is also 2. Does that mean the grand total is 2 + 2 = 4? No, the 2 codes in one column arte the same 2 codes as in the other column. We need to get both currency_cd and currency_cd_hsot into the same column, and then do COUNT (DISTINCT ...) on that combined column. A UNION, as shown above, will certainly do that, starting with your query as you posted it. The query you posted isn't necessarily the best frist step towards this result, however, so there may be a much better approach, depending on your tables.
Edited by: Frank Kulash on Feb 1, 2012 6:21 PM
Here's a slightly shorter, and probably more efficient way to get the same results:
WITH cntr AS
SELECT LEVEL AS n
FROM dual
CONNECT BY LEVEL <= 2
SELECT eb.person_seq_id
, SUM (eb.bonus_amount) AS total-amount
, COUNT ( DISTINCT CASE
WHEN c.n = 1
THEN eb.currency_cd
ELSE ed.currency_cd_host
END
) AS distinct_currency_cds
FROM fr_emp_bonuses eb
, fr_emp_details ed
, fr_periods p
, cntr c
WHERE eb.person_seq_id = ed.person_seq_id
AND ed.period_seq_id = eb.period_seq_id
AND ed.period_seq_id = p.period_seq_id
AND p.period_status = 'CURRENT'
AND eb.bonus_amount >= 0
AND eb.person_seq_i = 3525125
-- NOTE: no join condition involving c; we really do want a cross-join
GROUP BY eb.person_seq_id
; -
How to create a foreign key for the table from two different tables?
Hi All,
I have a three table like below. In the below table SAMPLE_CONS_CHECK and SAMPLE_CONS2_CHECK will be having the primary key for NAME column. The same SAMPLE_CONS3_CHECK table also having the primary key for NAME column and forieign key for SAMPLE_CONS_CHECK and SAMPLE_CONS2_CHECK tables. See the below code 2
code 1:
CREATE TABLE SAMPLE_CONS_CHECK
(NAME VARCHAR2(10),
SERIES VARCHAR2(5)
CREATE TABLE SAMPLE_CONS2_CHECK
(NAME VARCHAR2(5),
MODEL NUMBER
CREATE TABLE SAMPLE_CONS3_CHECK
(NAME VARCHAR2(5),
MODEL_NO NUMBER
)code 2
alter table SAMPLE_CONS_CHECK
add constraint SAMPLE_CONS_CHECK_pk primary key (NAME)
alter table SAMPLE_CONS2_CHECK
add constraint SAMPLE_CONS2_CHECK_pk primary key (NAME)
alter table SAMPLE_CONS3_CHECK
add constraint SAMPLE_CONS3_CHECK_pk primary key (NAME)
ALTER TABLE SAMPLE_CONS3_CHECK ADD
CONSTRAINT SAMPLE_CONS3_CHECK_FK1 FOREIGN KEY
NAME
) REFERENCES SAMPLE_CONS_CHECK
NAME
) ON DELETE CASCADE;
ALTER TABLE SAMPLE_CONS3_CHECK ADD
CONSTRAINT SAMPLE_CONS3_CHECK_FK2 FOREIGN KEY
NAME
) REFERENCES SAMPLE_CONS2_CHECK
NAME
) ON DELETE CASCADE;From the above schenario i am able to insert the data to SAMPLE_CONS3_CHECK table. But the parent data is already available in the parent table. The problem is here two different constarints from two different tables. While inserting, it is checking from both the tables whether the parent is exist or not.
How can i solve this problem? Can anyone halp me about this?
Thanks
Edited by: orasuriya on Aug 8, 2009 2:02 AMActually the design is completely incorrect.
What you say is
I have
'foo', 'foo series'
'foo','foo model'
'foo',666
By virtue of table3 referring to both table1 and table2.
This means you actually need to have 1 (one) table:
'foo','foo series','foo model', 666
And the 'problem' disappears.
Sybrand Bakker
Senior Oracle DBA -
How to create Analysis from two different subject areas with diff models
Hello,
I have problem with create analysis from two different areas with two different models (Model Star and Snowflakes) build in BI Admin tools.
First Model A = Subject Area A have one fact tables (with measures) and three dimensions tables (Model Star)
Second Model B = Subject Area B have one fact table (no measures) and five dimensions tables (Model Snowflakes).
I'm looking solutions how I can give good results. In this case I can't use UNION, INTERSECT etc., because this models haven't the same number column and data type?
whether it is possible to do in OBIEE?
Please help me
Kind regard
robixHi
One thing to understand is that if your are imagining having two Subject Areas (SAs) displayed and then dragging columns from each into your Request without any preparation, then no, that can't be done. You would need to do a join in the BMM layer and expose the column from the second Subject Area in the presentation layer.
But if you indeed interested in UNION (or intersect) queries, then do this:
Build your first query in the first SA in the usual manner. Note the number of columns and the data types of each column.
Now at the bottom of the Criteria workspace, there is a button called "Combine with similar request." Click it.
Select your second SA. You will note that the outlines of the columns in your first query appear. This is to remind you that the number of columns in this second query must be the same as in the first. It also shows the data type of each column for the same reason.
Once you select your columns and your filters, click on result. (Oh, you will also need to decide what kind of combination you want -- click on the dropdown.) The result will be a new Request that has data from both SAs in the query and combined in the manner you select (union, intersect, etc.)
That should give you a start.
http://obiee101.blogspot.in/2010/08/obiee-combine-with-similar-request.html -- Read this link this is good one to understand with screen shots. -- OBIEE 10g
http://oraclebiee11g.blogspot.in/2011/01/querying-across-multiple-subject-areas.html -- OBIEE 11g
Award Points it is useful.
Thanks
satya -
Please Help!!!
How to write a case statement for the totals column of two different years (2013 and 2014) of the same month so that I can get a +/- column.
January 2014 January
2013 +/-
Region Entry Exit Total Entry Exit Total (Total of Jan2014-Total of Jan2013)
A 2 3
40 5 7 30 40-30= 10What is a table structure? Sorry cannot test it right now..
SELECT <columns>,(SELECT Total FROM tbl WHERE Y=2014)-(SELECT Total FROM tbl WHERE Y=2013)
FROM tbl
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
How to calculate AGE from two different date fields
hi
I need to calculate AGE from two different date fields.
Can some help me how to do, when i try to do substraction formula it is showing error.
Thank You
ManuManu wrote:
Hi
Both fields are in date format only, i need to calculate no . of days between two different dates
Thanks
ManuThe reason for the question about the format of the column is because the simplest solution only works on DATE columns. Others have mentioned this here, but if you want the difference between two date fields, you can use this formula:
TIMESTAMPDIFF(SQL_TSI_DAY, date_column1, date_column2)
The above being said, you still didn't tell me what you did, or what error message you received. So again, if the above formula didn't work, what did you do? Where did you put the formula? What was the exact syntax you used? What was the error message you got?
Please don't make us work more than we need to. Answer all the questions in your next post. Thanks. -
Selecting data from two different tables.
Do we need to use join two tables with primary/foreign key while trying to use select statement for getting data from those to table.? If no who can i go about do it.
872959 wrote:
If i am using From clause to get data from two different tables, is it necessary that both tables have column of identical data in them.In general, they ought to (or you need to join in a third table that tells you how to map rows from one table to rows of the other table).
It is not strictly necessary that there be any join condition between tables. If you don't provide a join condition, Oracle has to do a Cartesian product. That means that if there are n rows in one table and m rows in the other, the result set will have n * m rows. It is very rarely a good idea to write queries that do Cartesian products but it does occasionally happen.
Justin -
To find Common data in 2 columns in two different tables.
Hi,
Could someone help me out with a querry to find out common data from 2 columns in two different tables??
Thanks
Rajesh966915 wrote:
suppose i hav 2 tables
Table A
s.No name EID
1 aaa 123
2 bbb 234 ... etc..
and Table B
S.no salary eid location
1 mmm$ 123 india
2 ddd$ 556 Uk
3 fff$ 236 US
How do i select the common entry in both the tables??why do you post in forum for SQL & PL/SQL; yet never post anything in either language?
what do you mean by "common enrty"?
does every column value must match exactly across 2 rows in different table? -
APEX Application accessing data from two different databases
Hi All,
Currently as we all know that APEX Application resides in database and is connected to the schema of that database.
I want APEX Application to be running and accessing data from two different databases. Elaborating my question,
Currently, my APEX Production Application is connected with XXXX Schema of DB1 Database(Where APEX Resides). Now I want to add some pages into this APEX Application for REPORT Purpose, But I want to connect this REPORT APEX Pages to get data from Different Schema YYYY for Database DB2.
Is it possible to configure this scenario?
The reason for doing this is to avoid the REPORT related (adhoc queries) resource utilization effect on Production DB1 Database.
Thanks
Nil1. If you do the joining of two or more tables in DB1 then all data is pulled over to DB1 and then the join is executed: so more data over the databaselink and more work for DB1. Better keep the joining stuff where the data resides and just pull exactly that data over that you need.
2. Don't know about your different block sizes. Seems a nice question for one of the other forums (DBA or SQL).
3. I mean create synonyms on DB1 for reports VIEWS in DB2.
Hope all is clear! -
Report which reads data from two different systems
Hi experts!
By any chance, would be possible to create a report which is able to read from two different cubes and two different systems at the same time?
Kind regards.Good afternoon Raul,
It should be possible to create a multiprovider on the two different cubes from the two sources
systems and report on this.
Best Regards,
Des -
Downloading songs from two different computers, and not recognizing songs
On my home computer, I downloaded about 40 songs onto my IPod from CDs. Then, I installed the program on my work computer, and purchased four songs from ITunes. When I plug my IPod into my work computer, it is not recognizing the songs I downloaded from my home computer. However, if I plug my IPod into my work computer, I can listen to these four purchased songs, but once I try to listen to them without having it plugged into my work computer, only the songs I downloaded from home are on the IPod.
Has this happened to anyone else who has tried to put songs from two different computers onto their IPod?Just to elaborate a bit, you need to copy the purchased files and put them on your home computer.
Don't burn them as an audio CD as you will lose quality when you re-import them.
You can use the Shuffle (instead of a CD) to do this
Check out this link.
http://docs.info.apple.com/article.html?artnum=61131
Maybe you are looking for
-
Work Item redirected to different approver without substitution
Hi All, We are facing an issue for Purchase Order Approval Workflow whereas Work Items are going to different approver without substitution is activated. Regards Chayan
-
Duplicate a text field in LC & get the Text automaticaly in the 2nd
Hi I want to duplicate a text field the problem is that i want something more when i write in the first "Text Field" i would like that the same Text appears automaticaly in the second "Text field" We can do it in Acrobat Pro but i don't know in LC T
-
I'm new to DROID (and coming from BB) so I hope I'm expplaining this right... I'm using my aol account through the email "widget". When a call, text message, or email comes in while I'm composing an email the email is lost. My message isn't automatic
-
I have purchased the new audioslave album(great) However I cannot get anything out of the interactive booklet. I have tried in quick time and the same thing happens - It has a progress bar and a timer of 11 seconds but that is it. I thought it was ar
-
Problem connecting to computer
I've just upgraded my laptop to windows xp pro from xp home and since this my laptop hasn't recognised my iPod mini 6GB but if i connect it to my home computer then it does work. What is wrong with my laptop to cause this??