Using union
I have these views using union
create or replace view V_CONSULTATION_SUMMARY
AS SELECT
Consul_date "DATE",
Consultation_No,
TO_NUMBER(NULL) "RECEIPT_NO",
Consultation_fee "CREDIT",
TO_NUMBER(NULL) "AMOUNT_PAID"
FROM consultation
union select
B.Receipt_Date "DATE",
A.Consultation_No,
B.Receipt_No "RECEIPT_NO",
TO_NUMBER(NULL) "CREDIT",
B.Amount_Paid "AMOUNT_PAID"
FROM consultation A, Receipt B WHERE
b.Consultation_No=A.Consultation_No
ORDER BY "DATE", Consultation_No, RECEIPT_NO;
create or replace view V_PATIENT_FINANCIAL_RECORDS
AS SELECT
A.PID,
B.*
FROM cONSULTATION A, V_CONSULTATION_SUMMARY B
WHERE A.Consultation_No=B.Consultation_No;
then I tried to access it from oracle forms using datablock wizard to access both views, and both of them failed. could some one tell me why. The error message is:
FRM-40505: ORACLE error: unable to perform query
thank's
Why not?
but, you should try it next time ->
insert into <dest_table>
select BKNO,BKNAME,AUTHORNAME,PUBLISHER,PRICE,STATUS
from (
select BKNO,BKNAME,AUTHORNAME,PUBLISHER,PRICE,STATUS
from lib_bk_det
union
select BKNO,BKNAME,AUTHORNAME,PUBLISHER,PRICE,STATUS
from lib_bk_det_20
);N.b.: Not Tested...
Regards.
Satyaki de.
Similar Messages
-
Adding new column in an existing report which was build using Union
While working in OBIEE 11g I encounter an issue.
My existing report was build using UNION at Criteria Tab in Analysis. Now I have a requirement to add a new column into the same report. For each criteria I have added the new column but when I go back to the "Result Columns". I see a new field added but it is not allowing me to open or edit column properties for that new column & at the same time it is not allowing me to navigate to other tabs like Results, Promts, and Advanced.
I don’t want to build this report from scratch. Is there any workaround to get it resolved?Hi,
Just check it once the new added column data types are mismatched or not?
and the new added column should be navigated into excluded section, so u should edit the report and dragged into the table column section.
Thanks.. -
How to get the values in a single row without using union
Hi,
I have a table with the following structure and data
empid address phoneno emailid
1001 xyz
1001 1234234
1001 [email protected]
1002 23434
1002 [email protected]
1003 abcd
1003 [email protected]
1004 [email protected]
I need to have a result in this format.
emp id address phoneno emailid
1001 xyz 1234234 [email protected]
1002 23434 [email protected]
1003 abcd [email protected]
1004 [email protected]
I can do it using union however that gives a performance issues with a large table. So I wish to do using in any other way using lead or something, but with the complexity about the data, I couldn't do it.
Can anyone please help me?
Natarajan
Edited by: Nattu on Dec 3, 2009 3:50 PMSelect employee_id, max(address), max(phone), max(email)
from emp
group by employee_id;Max -
Query takes long when using UNION
Hi ,
I habe a query as follows;
SELECT
'9999' site_id,
m.ghi_prov_num provnum,
SUBSTR (l.seq_num, 1, 3)provloc,
t.dea_number dea,
t.license_number statelicensenumber ,
n.npi_num npi,
m.prefix prefixname,
m.lastname lastname,
m.firstname firstname,
t.middle_name middleinitial,
m.suffix suffixname,
null clinicname,
l.street1 addressline1,
l.street2 addressline2,
l.city city,
l.state state,
l.zip5 zip,
l.phone phoneprimary,
null ext,
null fax,
null email,
null alt_phone,
null alt_phone_ext
FROM provider m, LOCATION l, npi n,TEMP_VITAL_CACTUS t,test_provider_pin pin
WHERE m.ghi_prov_num=l.ghi_prov_num
and m.ghi_prov_num=n.ghi_prov_num(+)
and m.ghi_prov_num=t.ghi_prov_num(+)
and m.tax_id=pin.tax_id
UNION
SELECT
'9999', m.ghi_prov_num ,
m.location provloc,
null ,
null ,
n.npi_num ,
null ,
m.lastname ,
m.firstname ,
null,
null ,
null ,
m.street1 ,
m.street2 ,
m.city ,
m.state ,
m.zip5 ,
m.phone ,
null ,
null ,
null ,
null ,
null
FROM dental_provider m, npi n,test_provider_pin pin
WHERE m.ghi_prov_num=n.tax_id(+)
and m.location=n.location(+)
and pin.tax_id=m.ghi_prov_num;The query takes for ever;
But Individual query takes less than a sec to execute.Is there any way can i rewrite the query?
Please help
Hena.user11253970 wrote:
But Individual query takes less than a sec to execute.Is there any way can i rewrite the query?Have a feeling you are using Toad/SQL Navigator or similar tool which returns data one screen at a time. If so, then it does not "takes less than a sec to execute" but rather to fetch first screen of rows. When you use UNION Oracle has to return distinct rows from both queries. Therefore it must fetch not just first screen but all rows. To verify, issue first query and in yiour GUI tool click on get last screen. Then you'll know how long whole select takes. Do the same for second query. Also, do you need distinct rows or akll rows? IF all rows, change UNION to UNION ALL.
SY. -
How to use union statement with declare & set function?
Hi Experts,
i have small query about how to use union statement with declare & set function?
Example as below :
DECLARE @name AS date
Declare @name2 AS date
/* SELECT FROM [2013].[dbo].[OINV] T0 */
/* WHERE */
SET @name = /* T0.DocDate */ '[%1]'
SET @name2 = /* T0.DocDate */ '[%2]'
select '2013',t5.U_salmannm,t1.CardName,t2.sumapplied as CollectionAmount,t2.DcntSum ,t3.DocTotal as InvoiceTotal,
datediff(dd,t3.DocDate,t1.Docdate) as Days
from 2013.dbo.orct t1
inner join 2013.dbo.RCT2 t2 on t1.DocNum = t2.DocNum
left join 2013.dbo.oinv t3 on
t3.docentry = t2.baseAbs
inner join 2013.dbo.ocrd t4 on t1.Cardcode = t4.CardCode
inner join [2013].[dbo].[@CQ_RTSM] t5 on t4.U_BeatCode = t5.U_RoutCode
where t2.DcntSum <> 0.000000 and t3.DocDate between [%1] and [%2]
Union
/* SELECT FROM [2014].[dbo].[OINV] T0 */
/* WHERE */
SET @name = /* T0.DocDate */ '[%1]'
SET @name2 = /* T0.DocDate */ '[%2]'
select '2014',t5.U_salmannm,t1.CardName,t2.sumapplied as CollectionAmount,t2.DcntSum ,t3.DocTotal as InvoiceTotal,
datediff(dd,t3.DocDate,t1.Docdate) as Days
from 2014.dbo.orct t1
inner join 2014.dbo.RCT2 t2 on t1.DocNum = t2.DocNum
left join 2014.dbo.oinv t3 on
t3.docentry = t2.baseAbs
inner join 2014.dbo.ocrd t4 on t1.Cardcode = t4.CardCode
inner join [2014].[dbo].[@CQ_RTSM] t5 on t4.U_BeatCode = t5.U_RoutCode
where t2.DcntSum <> 0.000000 and t3.DocDate between [%1] and [%2]You have to create stored procedure in SQL only .
Like u must have create for Crystal .
You can execute procedure in query manager but you have to enter parameter manually..
example
Exec @Test '20140101' '20140501'
Every time user has to enter it manually in yyyymmdd format in case of date parameters.
Example
Create Proc [@Test]
as begin
DECLARE @name AS date
Declare @name2 AS date
/* SELECT FROM [2013].[dbo].[OINV] T0 */
/* WHERE */
select '2013',t5.U_salmannm,t1.CardName,t2.sumapplied as CollectionAmount,t2.DcntSum ,t3.DocTotal as InvoiceTotal,
datediff(dd,t3.DocDate,t1.Docdate) as Days
from 2013.dbo.orct t1
inner join 2013.dbo.RCT2 t2 on t1.DocNum = t2.DocNum
left join 2013.dbo.oinv t3 on
t3.docentry = t2.baseAbs
inner join 2013.dbo.ocrd t4 on t1.Cardcode = t4.CardCode
inner join [2013].[dbo].[@CQ_RTSM] t5 on t4.U_BeatCode = t5.U_RoutCode
where t2.DcntSum <> 0.000000 and t3.DocDate between @Name and @Name2
Union
/* SELECT FROM [2014].[dbo].[OINV] T0 */
/* WHERE */
select '2014',t5.U_salmannm,t1.CardName,t2.sumapplied as CollectionAmount,t2.DcntSum ,t3.DocTotal as InvoiceTotal,
datediff(dd,t3.DocDate,t1.Docdate) as Days
from 2014.dbo.orct t1
inner join 2014.dbo.RCT2 t2 on t1.DocNum = t2.DocNum
left join 2014.dbo.oinv t3 on
t3.docentry = t2.baseAbs
inner join 2014.dbo.ocrd t4 on t1.Cardcode = t4.CardCode
inner join [2014].[dbo].[@CQ_RTSM] t5 on t4.U_BeatCode = t5.U_RoutCode
where t2.DcntSum <> 0.000000 and t3.DocDate between
between @Name and @Name2
end -
Hi Gurus,
I have three tables. I want to join all tables using union in SQL statement. The query is returning all the records from both tables but i only require unique rows based on a specific column value. Here is my table structure -
TableA -
LIC_ID NUMBER(10) NOT NULL
LIC_NUMBER VARCHAR2(20)
COMMENCE_DATE DATE
EXPIRY_DATE DATE
TERM VARCHAR2(20)LIC_ID is the primary key in this table -
Sample data from TableA
LIC_ID LIC_NUMBER COMMENCE_DATE EXPIRY_DATE TERM
2 TR4323 12/04/2008 11/03/2010 2 Years
34 TR5432 23/07/2009 22/07/2010 1 Year
45 TR5321 24/06/2009 23/06/2010 1 Year
65 TR6666 23/07/2010 22/07/2011 1 Year
32 TR2423 30/05/2010 29/05/2011 1 YearTableB -
MAR_ID NUMBER(10) NOT NULL
LIC_ID NUMBER(10) NOT NULL
ZONE_NAME VARCHAR2(20)
DEPARTMENT VARCHAR2(20)
ACTIVITIES VARCHAR2(200)
COMMENTS VARCHAR2(200)MAR_ID is the primary key in this table and LIC_ID is the foreign key on TableA
Sample data from TableB -
MAR_ID LIC_ID ZONE_NAME DEPARTMENT ACTIVITIES COMMENTS
23 2 ZONE A IT NONE
43 34 ZONE B IT NONE
33 65 ZONE C ACCOUNT NONE
TableC
REC_ID NUMBER(10) NOT NULL
LIC_ID NUMBER(10) NOT NULL
DIST_NAME VARCHAR2(20)
REGION VARCHAR2(20)
ACTIVITIES VARCHAR2(200)
COMMENTS VARCHAR2(200)REC_ID is the primary key in this table and LIC_ID is the foreign key.
Sample data -
REC_ID LIC_ID DIST_NAME REGION ACTIVITIES COMMENTS
2 45 SA NORTH NONE
3 65 TA NORTH NONE
5 32 NT SOUTH NONEHere is my sql query -
select a.lic_id, a.lic_number, a.commence_date, a.expiry_date from
TableA a, TableB b
where a.lic_id=b.lic_id
union
select a.lic_id, a.lic_number, a.commence_date, a.expiry_date from
TableA a, TableC c
where a.lic_id=c.lic_idThe above query returns -
lic_id lic_number commence_date expiry_date
2 TR4323 12/04/2008 11/03/2010
34 TR5432 23/07/2009 22/07/2010
45 TR5321 24/06/2009 23/06/2010
65 TR6666 23/07/2010 22/07/2011
32 TR2423 30/05/2010 29/05/2011
65 TR6666 23/07/2010 22/07/2011 LIC_ID 65 exists in both table TableB and TableC hence it repeats in query but I want to display that only once. How can I do that? I want to return unique record on LIC_NUMBER.
Hope this make sence.
Many thanks,
TajuddinThanks for all your reply and suggestions. David altering session did not work.
Sven your idea helped me to figure it out what to do. I found a way around to fix it. Here is my current code -
select a.lic_id, a.lic_number, a.commence_date, a.expiry_date from
TableA a, TableB b
where a.lic_id=b.lic_id
union
select a.lic_id, a.lic_number, a.commence_date, a.expiry_date from
TableA a, TableC c
where a.lic_id=c.lic_id and c.lic_id not in ( select lic_id from TableB)This will exclude any LIC_ID exists in TableB.
Thanks again for your help guys.
Regards,
M Tajuddin
Web: http://tajuddin.whitepagesbd.com
Blog: http://aspblog.whitepagesbd.com -
Writing query using UNION Operator
Question -
(1)
Write an SQL Statement to list the following items: Customer ID, Customer Name, number of invoices, sum of total for invoices. Ensure that all customers are returned in the result set.
Answer for the above is written as below by one person. That seams to be correct. Is there another way of writing this same query.;
select c.CUSTOMER_ID,c.NAME,i.cnt,i.s
from gee_customer c,(select customer_id,count(*) as cnt, sum(TOTAL) as s
from gee_invoice
group by customer_id) i
where c.CUSTOMER_ID = i.customer_id (+)
(2)
My other question is How to write the above answer (or what you sugest) using UNION operator ?
Any ideas please
Message was edited by:
user483578In fact the outer join means you use the union of two result sets - usual join result
and the rows from the outer table for which there is not any row in the inner table.
SQL> select d.deptno, e.ename from emp e, dept d
2 where d.deptno = e.deptno(+)
3 order by 1,2
4 /
DEPTNO ENAME
10 CLARK
10 KING
10 MILLER
20 ADAMS
20 FORD
20 JONES
20 SCOTT
20 SMITH
30 ALLEN
30 BLAKE
30 JAMES
30 MARTIN
30 TURNER
30 WARD
40
15 rows selected.
SQL> select d.deptno,e.ename from emp e, dept d
2 where d.deptno = e.deptno
3 union
4 select deptno, null
5 from dept d where not exists (select null from emp e where e.deptno = d.deptno)
6 order by 1,2
7 /
DEPTNO ENAME
10 CLARK
10 KING
10 MILLER
20 ADAMS
20 FORD
20 JONES
20 SCOTT
20 SMITH
30 ALLEN
30 BLAKE
30 JAMES
30 MARTIN
30 TURNER
30 WARD
40
15 rows selected.In your example something like (NOT tested !)
with i as (select customer_id,count(*) as cnt, sum(TOTAL) as s
from gee_invoice group by customer_id)
select c.CUSTOMER_ID,c.NAME,i.cnt,i.s
from gee_customer c, i
where c.CUSTOMER_ID = i.customer_id
union
select c.CUSTOMER_ID,c.NAME,null,null
from gee_customer c
where not exists (select null from i where c.CUSTOMER_ID = i.customer_id)
Rgds. -
HI,
I want to select data from 2 tables using Union in Popup LOV ,
please help.
I am getting a error message like
"LOV query is invalid, a display and a return value are needed, the column names need to be different. If your query contains an in-line query, the first FROM clause in the SQL statement must not belong to the in-line query."
when i use union query
my query is like this
select a from table 1
union
select b from table 2
order by a;Hi,
Three things -
1) Remove the semi-colon from the end of your query (it can work without it, but you'll eventually run into problems some day by putting a semi-colon on the end, so better to get into the habit of not doing it).
2) You need to provide 2 columns in your query, a display value and a return value (look at the error message you are getting). You are only returning a single column.
3) Wrap your query inside another query to get it to work.
Something like this should work -
select * from (
select 1 as r, 2 as d from dual
union
select 3 as r, 4 as d from dual)
order by dObviously change the values/columns to suit your own purposes.
Hope this helps,
John. -
How to do sum when using union
hi,
i am getting following example data from a query
which uses UNION which is mandatory.
is there a way to do sum of Units column to get a single
row ?
hire date units
01.08.2003 1,00
01.08.2003 12,50
like to see as a single row
01.08.2003 13,50
rgds,
KarnaSELECT hire_date, SUM(units) units
FROM (SELECT hire_date, units
FROM table1
UNION ALL
SELECT hire_date, units
FROM table2)
GROUP BY hire_dateTTFN
John -
Cannot export query output when using UNION ALL
Hi
I can run a query in SQL Developer 1.5.5 and if it's a SELECT statement it works fine, but if I output the result of several SELECT statements using UNION ALL after some 10,000 records the SQL Developer crashes and it generates a file whose size is 0 kb
Is there a workaround for this??
Thanks and Regards!
IsaacShould be fixed in the upcoming 2.1... you can try the RC1 also...
Regards,
K. -
hi
i need the query to fetch the data ...
i have two table
1. plan
2. voidplan
each table has id uniquely, and each table has rep_id but it is not unique.
i retrieved the data from both table using union. now i need the data for the rep who is in both table. i want to check union by id, and i need to retrieve the reps who is in both tables.
my code is
select "PLAN"."ID" as "ID",
"PLAN"."REP_ID" as "REP_ID",
"PLAN"."REGION" as "REGION",
"PLAN"."LOB" as "LOB",
"PLAN"."PLAN_HIERARCHY_CHANGE" as "PLAN_HIERARCHY_CHANGE"
from "PLAN" "PLAN" ,"VOIDPLAN" "VOIDPLAN" where "PLAN"."REP_ID" IN (SELECT REP_ID FROM VOIDPLAN)
UNION
SELECT "VOIDPLAN"."ID" as "ID",
"VOIDPLAN"."REP_ID" as "REP_ID",
"VOIDPLAN"."REGION" as "REGION",
"VOIDPLAN"."LOB" as "LOB",
"VOIDPLAN"."PLAN_HIERARCHY_CHANGE" as "PLAN_HIERARCHY_CHANGE"
from "VOIDPLAN" "VOIDPLAN"
THIS QUERY GIVES ALL UNION RESULT, NUT IT DOES'T FILTER THE REP_ID, IT SHOWS ALL THE REP_ID, I NEED THE REPS WHO IS IN BOTH TABLES
CAN ANYONE PLEASE TELL ME THE SOLUTION
regards
vally.sSQL> create table plan
2 as
3 select 1 id, 1111 rep_id, 'vally' rep_name from dual union all
4 select 2, 2222, 'kavi' from dual union all
5 select 3, 3333, 'shyam' from dual
6 /
Tabel is aangemaakt.
SQL> create table voidplan
2 as
3 select 5 id, 1111 rep_id, 'vally' rep_name from dual union all
4 select 6, 2222, 'kavi' from dual
5 /
Tabel is aangemaakt.
SQL> select case x when 1 then p.id else v.id end id
2 , p.rep_id
3 , p.rep_name
4 from plan p
5 , voidplan v
6 , (select 1 x from dual union select 2 from dual) x
7 where p.rep_id = v.rep_id
8 order by 1
9 /
ID REP_ID REP_N
1 1111 vally
2 2222 kavi
5 1111 vally
6 2222 kavi
4 rijen zijn geselecteerd.Regards,
Rob. -
Hello!
I need some correction in the following query. I am trying to make a 2 page QPLD so I am joining 2 queries and then printing the report into 2 pages.
SELECT T0.[U_OANumber], T0.[custmrName], T0.[U_Inspection], T0.[U_Cust_PO_Num],
T0.[U_ModelType], T0.[U_Duty], T0.[U_NamePlate],
T0.[U_Indicator_Obs], T0.[U_Fastners], T0.[U_Mounting_Type], T0.[U_Casing_Orientation], T0.[U_Impeller_Dia],
T0.[U_Bearing_Style], T0.[U_Motor_HP_Size], T0.[U_InsulationWedges], T0.[U_Varnish], T0.[U_Paint_Shade],
T0.[U_PlugsSeal], T0.[U_Remarks], T0.[U_Despatch]
FROM OINS T0 WHERE T0.[U_OANumber] = '[%0]' or T0.[customer] = '[%1]' or T0.[manufSN] = '[%2]'
Union all
SELECT T0.[U_ModelType], T0.[U_Size], T0.[U_Discharge], T0.[U_Head], T0.[U_RPM], T0.[U_YOM], T0.[U_HP],
T0.[U_Amps], T0.[U_Insulation_Class], T0.[U_Winding_Connection]
FROM OINS T0 WHERE
T0.[U_OANumber] = '[%0]' or T0.[customer] = '[%1]' or T0.[manufSN] = '[%2]'
Do I have to use the where clause just once since it is identical to both statements?
I get the error stating that all queries using Union, Intersect or Except must have an equal number of expressions. what does this mean?
scorp
Edited by: scorpion 666 on Feb 12, 2009 1:30 PMUnion has to have exact same numbers of fields to combine two results. Your query shows no need of union because your where clauses are identical.
Right syntax would be like this:
SELECT T0.[U_OANumber], T0.[custmrName], T0.[U_Inspection], T0.[U_Cust_PO_Num],
T0.[U_ModelType], T0.[U_Duty], T0.[U_NamePlate],
T0.[U_Indicator_Obs], T0.[U_Fastners], T0.[U_Mounting_Type], T0.[U_Casing_Orientation], T0.[U_Impeller_Dia],
T0.[U_Bearing_Style], T0.[U_Motor_HP_Size], T0.[U_InsulationWedges], T0.[U_Varnish], T0.[U_Paint_Shade],
T0.[U_PlugsSeal], T0.[U_Remarks], T0.[U_Despatch], T0.[U_Size], T0.[U_Discharge], T0.[U_Head], T0.[U_RPM], T0.[U_YOM], T0.[U_HP],
T0.[U_Amps], T0.[U_Insulation_Class], T0.[U_Winding_Connection]
FROM DBO.OINS T0 WHERE T0.[U_OANumber] = '[%0]' or T0.[customer] = '[%1]' or T0.[manufSN] = '[%2]'
Thanks,
Gordon -
Need sql query to remove duplicates using UNION ALL clause
Hi,
I have a sql query which has UNION clause.But the UNION clause is causing some performance issues.
To overcome that I have used UNION ALL to improve performance but its returning duplicates.
Kindly anyone send a sample SQL query where my primary objective is used to use UNION ALL clause and to consider unique rows (elimating duplicate
ones)
Any help will be needful for me
Thanks and Regardswhy not UNION? :(
another way also use MINUS
SQL>
SQL> with t as
2 (
3 select 1 if from dual union all
4 select 2 if from dual union all
5 select 1 if from dual union all
6 select 3 if from dual union all
7 select 3 if from dual
8 )
9 ,t2 as
10 (
11 select 1 if from dual union all
12 select 2 if from dual union all
13 select 3 if from dual union all
14 select 4 if from dual union all
15 select 5 if from dual
16 )
17 (select if from t
18 union all
19 select if from t2)
20 /
IF
1
2
1
3
3
1
2
3
4
5
10 rows selected
SQL> so
SQL>
SQL> with t as
2 (
3 select 1 if from dual union all
4 select 2 if from dual union all
5 select 1 if from dual union all
6 select 3 if from dual union all
7 select 3 if from dual
8 )
9 ,t2 as
10 (
11 select 1 if from dual union all
12 select 2 if from dual union all
13 select 3 if from dual union all
14 select 4 if from dual union all
15 select 5 if from dual
16 )
17 (select if from t
18 union all
19 select if from t2)
20 minus
21 select -99 from dual
22 /
IF
1
2
3
4
5
SQL> -
Can we use Union in ABAP???
Can we use Union in ABAP???
I have scenario like,
in an internal table i have entrie like this,
comp code field1 field2 field3 field4 field5
0A1 ABC BCD 00 00 00
0A1 00 00 CDE 00 00
0A1 00 00 00 EFG IJK
but i need a single entry like this,
comp code field1 field2 field3 field4 field5
0A1 ABC BCD CDE EFG IJK
how to do this????You cannot use SELECT on internal tables so the question of UNION does not arise. Also, you cannot use UNION in ABAP. You need to code it to get the desired output
Move the first line of your internal table to a new int table i_ftab.
DATA: num TYPE char1.
num = 2.
DO.
READ TABLE i_tab -> initial internal table
INTO wa_tab INDEX num.
IF sy-subrc NE 0.
EXIT.
ENDIF.
IF wa_tab-code NE '000'.
MODIFY i_ftab INDEX 1 FROM wa_tab TRANSPORTING code.
ELSEIF wa_tab-field1 NE '000'.
MODIFY i_ftab INDEX 1 FROM wa_tab TRANSPORTING field1.
ENDIF.
num = num + 1.
ENDDO. -
Drill down problem when using union all combination
Hi All,
I have a simple report with a drill down. The report has three columns Region, Sales, Flag... which will drill down to detail level of sales. The Flag column has Y, N values and we added 'All' Value in flag so that the user can select Y, N and All from the table prompt in the report . We have used union all in the report using combination to add the ' All ' Value in the flag. The problem is that now the main report is not passing the Flag values to the detail report. Flag is prompted in the filter in detail report.
If I remove the 'All' value from Analysis with only Y N selection criteria the drill down works.
Is there any work around? I have to use table prompt and All value selection in flag for drill down.
Thanks,
ViratThe problem is without union all when doing combination of analysis drill down works, when I use combination drill down does not work because it does not pass the parameters for flag . I have used union all to add All value in flag.
-
Select extra row without using UNION ALL in pl/sql
Hi,
Can anyone tell me how to select extra row without using UNION or UNION ALL in pl/sql. Actually I want to have my o/p of query as partitioned by designation and ordered by salary and than one extra row which will contain the highest salary in a particular salary. My table has first_name,emp_id,designation and salary column. And I wnt the o/p as.
Mohinish,12212,SI,46000
Ram,11212,SSI,47000
Shyam,12133,SI,48000
Rick,9898,SI,46000
Rocky,12312,SSI,56000
Sariq,23948,SI,43000
Suman,12789,HR,49000
Sampy,12780,SI,46000
Parna,11111,HR,50000
Now the o/p should be.
Mohinish,12212,SI,46000
Rick,9898,SI,46000
Sariq,23948,SI,43000
Shyam,12133,SI,48000
Shyam,12133,SI,48000
Ram,11212,SSI,47000
Rocky,12312,SSI,56000
Rocky,12312,SSI,56000
Suman,12789,HR,49000
Parna,11111,HR,50000
Parna,11111,HR,50000
Thanks in AdvanceYou don't have to do a UNION or UNION ALL in PL/SQL but you would need to in SQL to get the desired output:
with data_recs
as (select 'Mohinish' first_name,12212 emp_id,'SI' designation,46000 salary from dual union
select 'Ram',11212,'SSI',47000 from dual union
select 'Shyam',12133,'SI',48000 from dual union
select 'Rick',9898,'SI',46000 from dual union
select 'Rocky',12312,'SSI',56000 from dual union
select 'Sariq',23948,'SI',43000 from dual union
select 'Suman',12789,'HR',49000 from dual union
select 'Sampy',12780,'SI',46000 from dual union
select 'Parna',11111,'HR',50000 from dual)
select first_name, emp_id, designation, salary from data_recs union all
select s.first_name, s.emp_id, s.designation, s.salary
from (select first_name,
emp_id,
designation,
salary,
row_number() over (partition by designation order by salary desc) high_salary
from data_recs
order by designation, salary) s
where s.high_salary = 1
order by designation, salary;
FIRST_NAME EMP_ID DESIGNATION SALARY
Suman 12789 HR 49000
Parna 11111 HR 50000
Parna 11111 HR 50000
Sariq 23948 SI 43000
Rick 9898 SI 46000
Mohinish 12212 SI 46000
Sampy 12780 SI 46000
Shyam 12133 SI 48000
Shyam 12133 SI 48000
Ram 11212 SSI 47000
Rocky 12312 SSI 56000
Rocky 12312 SSI 56000
Maybe you are looking for
-
Problem with calling message in EXIT_SAPML03T_001
Hi I need call message id 'zwm' type 'W' number 018 in exit EXIT_SAPML03T_001. Class exists, message too. But when I double click on message (018) information occurs that message doesn't exist. What should I do please help. Best regards, Greg.
-
I'm exploring Flex as a candidate to use for developing a web application that displays many graphs. The data displayed on the graphs are discreate values with associated stardar errors. I need to display the standard errors as an error bar - simil
-
Authorization: Can I check-out processes from Solution in Read mode?
Hi NG. I am building a new set of user roles, but seems to get stuck with this one. With T-code: SOLMAN_DIRECTORY I would like to issue read access to users, but still give them the possibility to check-out processes to the maintenance project. So fa
-
How do I read an excel file in java
I want to do my companies Budget. Currently its on a *xls spreadsheet, i will later move it to a my sql data base. How do I read this file as input in java and write a report as output ? thanks judy
-
Iphoto 08 and iphone - Events sync
Hi, if i have a bunch of events in my iphoto and i did not name them, will they sync to the iphone as the date of the event or as untitled ?