Two queries in one output in BEx is it possibl ?
Hi,
Is there a possibility in Bex Excel screen that we can output two queries at the same time , like 1st query in first half and second query 2nd half of the screen .I think its not possible but just wanna know if anyone came across such an issue
I know it is possible with WAD ...
Hi Raj,
You can execute 2 queries in one work book.First execute one query,place the cursor under query results area,go to tools->Insert query->execute.Save->Save existing work book.
When ever u open the work book u have to execute both the queries.Instead of executing twice you can use some options, so that it saves and reuses the input values and automatically refresh the queries when u open the work book(If the input values are fixed).
For that right click->Properties->Intraction tab
You can see 4 check boxes.check all boxes,ok for all queries and save.So when u open the work book it retrieves data.No need to give input values
Similar Messages
-
How to Combine two queries into One
Hi Gurus,
SQL> select * from v$version;
BANNER
Oracle Database 10g Release 10.2.0.4.0 - 64bit Production
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for Linux: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
SQL>
I have following two queries. How I can convert these two queries into one with the same result ?
Q1
SELECT id,vdate,vendorname,venddate,vid
FROM VENDOR
WHERE processid=32
AND venddate is null
AND vid in(select vid from view_vid where type='PDX')
AND (id,vdate) not in (select id,vdate from vkfl_is where task_id=55)
AND (id,vdate) in (select id,vidate from market_data where marketed_date is null)
AND id not in (select id from location)
Q2
SELECT id,vdate,vendorname,venddate,vid
FROM VENDOR
WHERE processid=20
AND venddate is null
AND vid in(select vid from view_vid where type='PBX')
AND (id,vdate) not in (select id,vdate from vkfl_is where task_id=40)
AND (id,vdate) in (select id,vidate from market_data where region_date is null)
AND id not in (select id from location)
I can UNION these two queries, but, is there any way I can write a single query with which gives me same result as above two queries?
Any help would be highly appreciated
Thanks in advanceHi,
You can do something like this, which will be more efficient than a UNION:
SELECT id, vdate, vendorname, venddate, vid
FROM vendor
WHERE ( ( -- Conditions that apply only to q1
processid = 32
AND vid IN (SELECT vid FROM view_vid WHERE type = 'PDX')
AND (id,vdate) NOT IN ( SELECT id, vdate
FROM vkfl_is
WHERE task_id = 55
AND (id,vdate) IN ( SELECT id, vidate
FROM market_data
WHERE marketed_date IS NULL
OR ( -- Conditions that apply only to q2
processid = 20
AND vid IN (SELECT vid FROM view_vid WHERE type = 'PBX')
AND (id,vdate) NOT IN ( SELECT id, vdate
FROM vkfl_is
WHERE task_id = 40
AND (id,vdate) IN ( SELECT id, vidate
FROM market_data
WHERE region_date IS NULL
-- The remaining conditions apply to both q1 and q2
AND venddate IS NULL
AND id NOT IN (SELECT id FROM location)
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
Explain, using specific examples, how you get those results from that data.
See the forum FAQ: https://forums.oracle.com/message/9362002 -
Two Queries in one XSQL-Template
Hi there,
is it possibile to use two queries in one xsql-template, which are generated two seperated trees of XML?
I think about something like that
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsql:query connection="bynet"
null-attribute-indicator="true"
xmlns:xsql="urn:oracle-xsql"
rowset-element = "COLLECTION"
tag-case="upper"
row-element = "FIELD"
id-attribute = "">
select c_formtype from offer_collection
</xsql:query>
<xsql:query connection="bynet"
null-attribute-indicator="true"
xmlns:xsql="urn:oracle-xsql"
rowset-element = "COLLECTION2"
tag-case="upper"
row-element = "FIELD"
id-attribute = "">
select c_formtype from offer_collection2
</xsql:query>
which should give me
<COLLECTION>
<FIELD>
<C_FORMTYPE>lala</C_FORMTYPE>
</FIELD>
</COLLECTION>
<COLLECTION2>
<FIELD>
<C_FORMTYPE>lala</C_FORMTYPE>
</FIELD>
</COLLECTION2>
Any way to do this?
Thanx for help,
Christian HartmannSure, just enclose two <xsql:query> tags by any other outer tag:
<something xmlns:xsql="urn:oracle-xsql" connection="demo">
<xsql:query> select * from emp </xsql:query>
<xsql:query> select * from dept</xsql:query>
</something> -
Combining two queries in one..
Hi,
Can someone tell me how to combine follwoing two queries in one so that it will increase performance..
SELECT single PLNNR from AFKO
into T1
WHERE AUFNR = '007200000100'.
SELECT single STATU from PLKO
into T2
WHERE PLNNR = T1.using subqueries it is possible
select single statu from plko into t2 where plnnr in (select single plnnr from afko where aufnr eq '007200000100').
read about subqueries at this link...
http://help.sap.com/saphelp_erp2004/helpdata/en/dc/dc7614099b11d295320000e8353423/frameset.htm
regards,
PJ -
How to combine two queries in one EXCEL
hi i got one requirement
i got one excel sheet from user which contains two report s(hoe we know whether it is worknook or not) of 2011 data and now user wants 2012 data .now i icluded jan 2012 to dec 2012 in two reports and sent to user.But user is asking these two reports want to see in one sheet.
so how can i proceed: if i go for work book how can i include these two reports in workbook and here my doubt is if i create a workbook based on these two querie which name i have to give user.Please help me out on the same.
Regards,
Madhu.Hi Madhu
Run one query. Click on a empty space in the excel
From the BEx Design Toolbar -
>Insert Analysis Grid -
> Right click on the Design Item
Edit the DataProvider.....You can ran same or different query with selection.
Save the result
Check this link for detail....I am also searching for something with screenshot
Regards
Anindya
Edited by: Anindya Bose on Feb 14, 2012 3:04 AM -
Hi,
I'd like to know what the disadvantages are of having two queries in the same worksheet of a workbook. Is it correct that the results of one query can overflow to the area of the second? How about issues with authorization, are there any?
Thanks!HI,
Yes, result of one can flow over the other if you are using simple report with characteristics and output may vary.
Actually you apply basic Excel logic and its like 2 diff report on it.
Mostly you add more Fixed format reports to a single sheet. So that number of report rows dont increase and also you dont have any free characteristics to drilldown.
About authorization, that depends on individual reports. If a user doesnt have proper authorization for 1 of the reports then that report would throw error while other would show result. -
I have two queries and I would like to output the results as
one and sort by Name ASC
Any help would be great thanksEither use union in your SQL query or use Coldfusion to
combine exisitng queries and create a new query resultset.
Something like this:
<CFQUERY NAME="getDetailsQuery1"
DATASOURCE="#DSNNAME#">
SELECT * FROM getDetailsA
</CFQUERY>
<CFQUERY NAME="getDetailsQuery2"
DATASOURCE="#DSNNAME#">
SELECT * FROM getDetailsB
</CFQUERY>
<CFQUERY NAME="getDetails" DBTYPE="query">
SELECT * FROM getDetailsQuery1
UNION
SELECT * FROM getDetailsQuery2
ORDER BY Name ASC
</CFQUERY>
Hope this helps!
Cheers / Manu. -
Two queries in one report?
I have Three tables like
Device_table columns are
d_id, d_name, date
Software_table
sw_id, software, version, serial_no, sw_type, d_id(foreign_key)
hardware_table
hw_id, hardware, specification, d_id(foriegn_key)
now in reports i want to attach both hardware and software, I have made two quires like
SELECT d.d_name, sw.software, sw.version, sw.sw_type from
device_table d, software_table sw
where d.d_id = sw.d_id
and second query is
SELECT d.d_name, hw.hardware, hw.specification
from device_table d, hardware_table hw
where d.d_id = hw.d_id
Now my problem is that how can I add both queries in one report so that i can get a list of software and hardware attached to one device.
Regards
MazI want to see the report as follow.
d_name: CPU-1
date: -----------
Software installed:
sw_id, software, version, serial_no, sw_type
(list of softwares attached, can be more then one)
Hardware attached:
hw_id, hardware, specification (same like software list, it will contain hardware list attached to specific device),
Please if you can help me that how will i make a query for this.
Thanks and Regards
Maz -
How do i run two queries in one worksheet?
Hi
I am new to Disco and am finding some things easy to fathom and others not so.
I have a table with fields
callref
logdate
closedate
I want to be able count the number of calls logged each month/year and the number of calls closed.
So, I want to do 2 counts, each count applying a slightly different condition. I would then end up with data along the lines of:
Month, Number Logged, Number Closed
which I could then turn into a graph.
I am assuming there must be an obvious way ...
Sapphie
Edited by: user12160673 on Feb 8, 2010 8:49 AMHi Lee
There's a couple of ways of doing this. I think the simplest would be create two calculations, one for Number Logged and one for Number Closed.
For Number Logged presumably this is just the count of all rows returned in the worksheet? You can use COUNT(ROWNUM) for that calculation.
For the Number Closed you only want to count those that have a closedate - yes? If so, this will work:
SUM(CASE WHEN closedate is NOT NULL THEN 1 ELSE 0)
Another way to do this, would be to create two analytic calculations, one for each count. The syntax for an analytic count is as follows:
COUNT(item) OVER (filters)
The item will be the thing you are counting. The filters can be left empty, in which case the count will be determined by all rows in the worksheet. If you want the count to be only on a subset of the rows then you need to provide one or more filters. Typical filters are page items and group sorted items.
An example of a count over the whole query is:
COUNT(callref) OVER ()
Best wishes
Michael -
Two Queries In One Workbook With Calculations
Hi Guys,
Can you have 2 queries in one worksheet, either ran as a query or save as a workbook and calculation done at runtime. For example, query A and query B to show up in one sheet when you run query A. You now want a simple calculation done......for example.......A1 row from query A divided by B1 row from query B. The result to show up on the Key Figure structure in query A.
Thanks,
Recca
Edited by: Recca Recca on Jul 11, 2011 4:45 PMHi,
I am not sure about this but we had similar kind of requirement and what we did was,
One query in one tab, another query on second tab and we did key figure calculations on third tab of the workbook eg. Sheet1 A1 - Sheet2-A1 and the result was stored on sheet3.
We saved the workbook and used to refresh the same whenever we want to see new data.
Regards,
Durgesh. -
Two queries to one question or how to query TV Scheduler
In my procedure I need to query an existed view, which has the follow columns: broadcasting_day_id (unique), broadcasting_date, channel_id and version and so.
If I have broadcasting_day_id, than I need to use WHERE broadcasting_day_id = my_parameter_1, if no, than I use WHERE broadcasting_date = my_param_2 AND channel_id = my_param_2 AND version = my_param_3.
Right now I have implemented it using IF broadcasting_day_id is not null THEN SELECT .... FROM .... WHERE broadcasting_day_id = my_param_1 ELSE WHERE
broadcasting_date = my_param_2 AND channel_id = my_param_2 AND version = my_param_3.
I would like to know if this is a good approach and if there is a way to combine those two statements in one, please?
Thanks in advanceHi,
If your query is fairly complicated and you don't like to repeat it, you could try something like:
WHERE broadcasting_day_id = NVL2 (my_parameter_1, my_parameter_1, broadcasting_day_id)
AND broadcasting_date = NVL2 (my_parameter_1, broadcasting_date, my_param_2)
AND channel_id = NVL2 (my_parameter_1, channel_id, my_param_3)
AND version = NVL2 (my_parameter_1, version, my_param_4);(Assuming you have four different parameters, you mentioned p2 twice)
Regards
Peter
Edit:
Yes, I know - looks kinda stupid after Ganesh got his nvl2 logic right ;)
Edited by: Peter on Apr 27, 2011 1:44 PM -
How to fire two queries in one bean
When I am trying to fire two queries using statement and result set
it is showing error "result set is closed".
How to fire two queries?Just do it. The ResultSet should be the result of the query. So you're working on a wrong reference or something.
-
Comparing two queries yields one result too many
I have a problem that I'm pretty sure is resident in the
structure of a loop, but I'm not quite sure how to fix it.
All of this is being done within a cfc. The cfc calls the
first method for Query1, then calls the second method for Query2.
Query1 has 173 records, Query2 has 117 records. Technically the
difference should be 56 records.
However, the result of myquery (below) is giving me 57
records. And every one of them is a real record. Code as follows:
<CFSET myquery = QueryNew("var1, var2, var3, var4,
var5")>
<CFLOOP INDEX="i" FROM="1" TO="#Query1.recordcount#">
<CFQUERY NAME="checkJob" DBTYPE="query">
SELECT var1
FROM Query2
WHERE var1 = <cfqueryparam cfsqltype="cf_sql_varchar"
value="#Query1.var1
#">
</CFQUERY>
<CFIF checkJob.recordcount lte 0>
<cfset newRow = QueryAddRow(myQuery, 1)>
<cfset temp = QuerySetCell(myQuery, "var1",
Query1.var1)>
<cfset temp = QuerySetCell(myQuery, "var2", Query1.var2
)>
<cfset temp = QuerySetCell(myQuery, "var3",
Query1.var3)>
<cfset temp = QuerySetCell(myQuery, "var4", Query1.var4
)>
<cfset temp = QuerySetCell(myQuery, "var5",
Query1.var5)>
</CFIF>
</CFLOOP>
<CFRETURN myQuery>
So if all is done correctly, I should be getting the results
from Query1 that are NOT in Query2.
It's *almost* right.
Since var1 exists in all of the records returned by myquery,
one presumes that there's an extra record being returned that *IS*
in Query2.
I'm not sure why, though.
The resultant screen needs to print out all of the variables
from query1 that do not exist in query2. Hence, myquery.
Anyone have a better recommendation on how to fix this
problem? I feel like a goober for even asking it, but it's been
annoying me all afternoon.
RizadosSimon, I would appreciate not being called lazy and yet
overly complicated in the same sentence. Ignorant, perhaps, overly
complicated, very likely, but lazy isn't the word I'd use.
When it comes to MSSQL, I was actually unaware I could use a
query of queries approximation without writing the whole thing out.
Thank you so much for correcting my ignorance. My apologies if this
isn't the type of database I've been using for the last few years,
and if my familiarity with the database is not as great as yours.
I have been trying to componentize this application where
applicable, and the queries I speak of were already componentized
prior to me coming into this. Both the primary and secondary
queries are being used by multiple applications on the same server,
and multiple times in the same page with different parameters (the
same page is being used several times). This third query is
obviously the difference between the two. If the second query has
to change at any time, then changing it only once within a
component makes more sense than having to find it multiple times
within the code to change it again, since the business rules on
said query have had to change a few times before. Better to have it
in one place than to change it in multiple places and risk having
one be changed while the others are not.
Lazy has nothing to do with it so much as accuracy. Multiple
instances of the same code means having to find it multiple times
when the code needs to change, and risking that you may miss one.
If they allowed me to use a view to do it as recommended by
cf_dev2, I would do so, and it would make my life a lot less
complicated. However, that option is not available to me, therefore
I have to go the "more complicated" route. -
Two LOV queries in one item... is it possible??
Hi,
I have created a list of value in DML form as below-
select pcrs.cost_record_status, pcrs.port_cost_record_status_id
from ptcs_cost_record_status pcrs
But, depends on "pcrs.port_cost_record_status_id" I only want certain values to show on the list.
For example:
--if pcrs.port_cost_record_status_id is 2
--then show status 2,3,4
select pcrs.cost_record_status, pcrs.port_cost_record_status_id
from ptcs_cost_record_status pcrs
where pcrs.port_cost_record_status_id in (2,3,4)
--if status id is 1
--then show status 1,5
select pcrs.cost_record_status, pcrs.port_cost_record_status_id
from ptcs_cost_record_status pcrs
where pcrs.port_cost_record_status_id in (1,5)
Any ideas on how I can have two different LOV in one item?
Thank you!!
LingLC wrote:
Hi,
port_cost_record_status_id is an ITEM and it will be retrieved from database when the form is opened.It doesn't look like one (the convention being that page items are prefixed with their page number, and referenced as bind variables using ":").
With respect to the original question above, the LOV query is:
select pcrs.cost_record_status, pcrs.port_cost_record_status_id
from ptcs_cost_record_status pcrs
where pcrs.port_cost_record_status_id in (2,3,4)
and :p1_port_cost_record_status_id = 2
union all
select pcrs.cost_record_status, pcrs.port_cost_record_status_id
from ptcs_cost_record_status pcrs
where pcrs.port_cost_record_status_id in (1,5)
and :p1_port_cost_record_status_id = 1 -
Combining two queries into one query if possible
Hi there. I would like, if possible, to somehow combine the queries 1) and 2) into a single query.
1) select distinct user_id from system_user_sessions;
This query returns all unique users from the indicated table.
2) select count(session_id) from system_user_sessions where user_id = "each user_id returned from 1)";
This query will return, for each distinct user_id, the number of sessions involving that user. In other words I would like to return the user_id of each user together with the number of session_ids involving that user.
any ideas? JoeI assume you are looking for something like this:
select count(session_id)
from system_user_sessions
where user_id in ( select distinct user_id
from system_user_sessions
);HTH
Ghulam
Maybe you are looking for
-
Extension Manager CS6 hangs on "Loading Extensions" and I cannot uninstall it.
Hello, I've been having trouble with extension manager cs6 for about two days now, trying to apply patches to it to make it run more smoothly and stop hanging on "Loading Extensions". I have looked through these forums and they suggested that I remov
-
Account 'Acquisition:Acquis. could not be found for area 01 AU133
To provide for reporting in USD group currency the leading ledger currencies for each company code has been changed from only local currency to also include the group currency (type 30) of USD. Once the above setting for group currency was made the f
-
Customer balances in Group Currency
Is there any way to get the Customer balances in Group currency - I am running TC S_ALR_87012172 for a UK Company Code. This TC provides me balances and details in GBP only and does not provide the option to get my USD balances. Is there any other tr
-
Navigation for an online portfolio website
Hello, I am creating a webpage to be my online portfolio for my graphic design work. I used a template, which originally uses a flash slideshow to navigate through the portfolio pieces. I would like to have it html instead, and give the user the abil
-
HT4623 IOS7.0.2 update slows the keypad with quite some delay very frustrating
Iphone IOS 7.0.2 has damaged the keyboard with exeptionally slow responses. How can this be fixed?