Issue with Results from Another Query (Error on Null value)
Hi All,
We have a WebI report using "Result from Another Query" option of BO XI R3.1. The report was running fine till recently the dimension object using result from another query had a null value. Report suddenly throwed error as the query filters are invalid.
Is there a way to make this filter optional if no data/null value is there ? Because we need those null values in report as well.
Thank you for your time.
Thanks & Regards
LN
Hi Vivek,
It was not directly solved but I applied alternate logic to over come the issue.
Here's what I did to overcome:
I used a sub query in place of the whole result from another query.
For Ex:
Dim1 inlist result from another query1
I made it as
Dim1 inlist (Dim0)
where Conditions.
Here Dim0 is the object which we use for Result from another query and Conditions will be the necessary filter conditions to arrive proper Dim0. Make sure proper context is formed for the sub query.
Even though it resolved my problem, It introduces an new issue. It causes increase in query run time when huge set of data is returned from sub query.
Please let me know if i haven't explained clearly.
Hi Aris_BO,
Sorry for not responding earlier. The logic would probably make more queries null & not null. Thats why I was not advised to use it.
Thanks
LN
Similar Messages
-
Unicode String Issue while Using Results from Another Query
Hi All,
In a webi report i have 2 queries say Sales Out and Investment. I need to have only those chains which are in Investement in Sales Out.
So in Sales Out query i am using the option Results from another Query. The Chain values are in Unicode format.
Though in universe i have Set Parameter Unicode_String ='Yes', this does not get applied when using option Results from another Query.
Is there any solution to resolve this problem.
Thanks
Madhuraleonhardtk wrote:
I need to take values from the column of one table that meets certain critera, and create inserts into another table that includes this data.
For example...
{code}
select emp_last_name from emp where emp_first_name like 'B%';
Duncan
Fitzgerald
Johnson
Smith
{code}
I then want to insert these values into another table:
{code}
insert into My_table values (
sequence.nextval,99,99,[last_name]);
{code}
In the example above, I need it to insert a new row into My_table for where the "last_name" is each of the names from the select statement above (Duncan, Fitzgerald,Johnson,Smith).
Based on other similar forum questions it looks like I should be doing something like:
{code}
INSERT INTO MY_TABLE
(SELECT sequence.nextval,
99,
99,
(select EMP_LAST_NAME
FROM EMP
WHERE EMP_FIRST_NAME LIKE 'B%')
{code}
But this (obviously) doesn't work!
Appreciate any assistance on this!
KSL.
Hi,
Created this test data
create table plch_test (name varchar2(50));
insert into plch_test values('AKSHAY');
insert into plch_test values('RAHUL');
insert into plch_test values('APARNA');
output
1 AKSHAY
2 RAHUL
3 APARNA
created another destnation table(in your case "my table")
create table plch_test_1 (id number,name varchar2(50));
created another sequence to generate employee ids
create sequence test_seq;
Now populated the desination table
insert into plch_test_1(select test_seq.nextval,name from plch_test);
verify the destination table
select * from plch_test_1
1 AKSHAY
2 RAHUL
3 APARNA
Hope this helps
Regards,
Achyut Kotekal -
Can we use Result from another query in Webi using Bex uery universe?
Hi,
Can we use Result from another query filter option in Webi to create a report using a Bex Query universe?
I need to create a report using two universes, one is Bex Query Universe and the other is Orcle universe. I have two queries, one is using Oracle universe; the other using Bex Query universe. I need to pass the Oracle data from the Oracle query to the Bex Query query to get the matched data from SAP Bex query.
I used Result from another query in the query filter panel for the query using Bex query universe. But I got an error saying that 'A filter contains a wrong value. you cannot run this query. (Error: WIS 00007). The data used in the filter on both sides are the same. they are char.
I have tested by using two queries from the same Bex query universe to see if the Result from another query filter option works. And I got the same error.
Has anyone run into the same issue and if this is possible and what should be the solution?
Thanks in advance!
Edited by: BO_Haiyan on Oct 6, 2010 3:47 PMIn that situation:
Create two queries : Oracle and BW query.
@ Report:
As you have to see result set from both the Dataproviders, correct? To achieve thise one must have common dimension objects to merge them at report and use Objects those are coming from both queries to use them in single Table/Report.
Unless you don't use Merge Dimensions, you don't get a chane to use both queries objects in single Table/Report. (It will give tooltip saying: You can't drop here -- Incompatable Objects)
In case, if you don't have common dimensions, change object definitions to Detail objects, for those required.
Hope it helps you.
Thank You!! -
Query on results from another query
Post Author: Duncan1980
CA Forum: Crystal Reports
Is it possible to query on the results from another query. I have a query that produces a list of document numbers. I want to use the output from that query as the filter criteria in a another query in the same Universe.
The output from the first query can be as much as 2000, so it would be very time consuming to cut and paste these into a filter.
Both reports are built, but can not figure out how to link the first report output to the filtering criteria on the second report. I
I am using business objects XI release 2 web intelligence 11.5.3.417 enterprise.Hi Vivek,
It was not directly solved but I applied alternate logic to over come the issue.
Here's what I did to overcome:
I used a sub query in place of the whole result from another query.
For Ex:
Dim1 inlist result from another query1
I made it as
Dim1 inlist (Dim0)
where Conditions.
Here Dim0 is the object which we use for Result from another query and Conditions will be the necessary filter conditions to arrive proper Dim0. Make sure proper context is formed for the sub query.
Even though it resolved my problem, It introduces an new issue. It causes increase in query run time when huge set of data is returned from sub query.
Please let me know if i haven't explained clearly.
Hi Aris_BO,
Sorry for not responding earlier. The logic would probably make more queries null & not null. Thats why I was not advised to use it.
Thanks
LN -
Results from another Query - not available
HI,
My environment is Business Objects XI 3.1 SP2 Edge series , i have below quereis with web Intelligence Reports
1. not available the functions/options Results from another Query(Any) or Results from another Query(ALL) at Query Level.
2. not getting list of Values for pronpt until i refresh values for prompt?
Please suggest me is there any fix packs available for the same to availle that functionality.
Best Regards,
Reddeppa Knot getting list of Values for pronpt until i refresh values for prompt?
There is option called "Automatic refresh before use" for the object properties available in the universe designer.
Please check the box for the object you are using for populating the list of values and export the universe.
not available the functions/options Results from another Query(Any) or Results from another Query(ALL) at Query Level.
There is a limitation for the query on query functionality that the both the queries can-not be from the OLAP universe.
I guess the query which needs to be filtered should be built on universe from the relational data base.
Regards,
Rohit -
Combine query, result from another query on SAP BI query Universe?
Hello all,
We are using SAP BI queries as datasource for our universes. Is the combined query option disabled for webi reports written on such universes?
result from another query - is this option active for such webi reports? I see both these options greyed out so wanted to check.
One last thing what is really difference between subquery and results from another query? subquery - you can use filters from that one data provider only right? or can you use a different data provider/report in sub query?
Thanks a lot for all the replies.Hi,
in BO 3.1 Combined query and result from another query options are not available in webi report on OLAP Universes (SAP BW Universe.)
Thanks,
Amit -
How to use Results from Another Query for SAP BW universes
Hi Everyone,
I have two SAP BI universes.In my First universe I have Sales Doc no (dimension) and Orderqty (Measure) and in my second universe I have Sales Doc no(Dimension) and BillQty (Measure).
Here in my first dataprovider I have 1200 rows of data and in second dataprovider I have 75,000 rows. The report should fetch only the BillQty details that matches to corresponding Sales doc no in first data provider.
I want to place all these fileds into a single report like as shown.
(Datarpovider1) (Datarpovider1) (Datarpovider2)
*Sales Doc No* Orderqty BillQty
Here I am able to generate single report using merge dimension but it is leading to performance issues. I want to restrict the values at query level by passing the First dataprovider Sales doc no to second Data provider Sales doc number using Results from Anothery Query feature so that It can fetch only the matching records.
I tried it but it was giving the follwing error:
A filter contains a wrong value. You cannot run this query. (Error: WIS 00007)
How Can I get rid of this error. Can we use Results from Anothery Query option for OLAP universe. Are there any limitation on it.
All this I am doing in Webi Rich Client.
Appreciate your help
Thanks &in Advance
Kiran SakaHi Kiran,
I think the filter has a wrong operand. For example, a filter with an empty constant, or a filter that deals with numeric values is defined with an alphanumeric value.Check out for this.
Regards,
Neeraj -
Update Query with Results From another Procedure
I am not sure if you can do this or what the proper format of the command might look like.
I have a stored procedure which insert records into a database. I want to insert the records which are returned by calling another procedure. This other procedure returns a cursor object to a variable named o_rows. Can this be done using Oracle 8i?
Insert into MyTable
MyStoredProcedure(oRows);You have a couple of options.
1) You can turn your stored procedure into a pipelined table function. This would allow you to do something like
INSERT INTO myTable
SELECT *
FROM TABLE( myStoredProcedure() );I don't believe that pipelined table functions were available in 8i, however.
2) The other option would be to fetch rows from the cursor and insert those into your table. Something like
LOOP
FETCH oRows INTO col1, col2, col3, col4, ...
INSERT INTO myTable( <<column list>> )
VALUES( col1, col2, col3, col4 );Note that for simplicity I am omitting the declarations of the local variables col1, col2, etc. and the check to see whether the cursor was exhausted.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
Creating JTree with results from SQL Query
I have the following source in SQLJ:
String temp=null;
iter1 it1;
iter2 it2;
#sql it1={select id,fdn,level from groups connect by prior fdn=parent_fdn start with fdn='/' };
while(it1.next())
System.out.println(it1.id()); // Display Parent
temp=it1.fdn();
#sql it2= {select clli from nes where parent_fdn=:temp order by clli };
while(it2.next())
System.out.println(it2.clli());//Display Child of above Parent if any
My problem is to construct a Tree GUI using JTree from the above
code with the same hierarchy of parent-child relationship.
I have tried every possible solution using Vectors,Hashtables,String Arrays etc but have not come up with a successful solution so far
IF ANYONE HAS A SOLUTION PLEASE HELP ME WITH AN EXAMPLE.
Thank You
Sharathsharathkv,
Your issue seems to be in figuring out an algorithm to convert row-based SQL resultsets to a hierarchical data structure suitable for display in a tree.
Run the jython (www.jython.org) app below: it simulates doing just that. jython is indentation-sensitive, so you'll need to exercise care when copying. If copy-paste to a text editor doesn't work, copy-paste to a HTML-aware editor (even Outlook Express, if on Windows), then copy from there and paste in a text editor.
--A
This is a jython (www.jython.org) app that illustrates
converting row-based data (eg. a SQL resultset) to a custom
hierarchical data structure, and displaying it in a JTree.
from javax.swing import *
from javax.swing.tree import *
import java
def getSQLRows():
Simulates a SQL resultset.
Columns fdn and parent-fdn indicate parent/child relationships.
rows = [
# id, fdn, parent-fdn, level
[1, '/', None, 1]
, [2, '/fruits', '/', 2]
, [3, '/colors', '/', 2]
, [4, '/sports', '/', 2]
, [5, '/fruits/apples', '/fruits', 3]
, [6, '/fruits/oranges', '/fruits', 3]
, [7, '/colors/red', '/colors', 3]
, [8, '/colors/blue', '/colors', 3]
, [9, '/sports/petanc', '/sports', 3]
, [10, '/sports/rugby', '/sports', 3]
return rows
def convertRowsToHierarchy(rows):
Converts row-based results to hierarchical structure.
Uses known parent/child relations present in rows.
root = None
for row in rows:
fdn, parentfdn = row[1], row[2]
node = SQLTreeNode(fdn, parentfdn)
if root:
root.addEx(node)
else:
root = node
return root
class SQLTreeNode(java.lang.Object):
'''Custom tree node; displayed in JTree'''
def __init__(self, fdn, parentfdn):
self.fdn = fdn
self.parentfdn = parentfdn
self.nodes = []
def add(self, node):
'''Adds node as immediate child'''
self.nodes.append(node)
def addEx(self, node):
'''Adds-with-search. NOTE: naive implementation'''
if self.fdn == node.parentfdn:
self.add(node)
else:
for child in self.nodes:
child.addEx(node)
def toString(self):
return self.fdn
def dump(self):
'''Debug routine to dump hierarchy'''
print 'fdn=%s, parentfdn=%s' % (self.fdn, self.parentfdn)
for node in self.nodes:
node.dump()
class SQLTreeModelAdapter(TreeModel):
'''Tree model adapter: adapts custom data structure to TreeModel'''
def __init__(self, root):
self.__root = root
def getChild(self, parent, index):
return parent.nodes[index]
def getChildCount(self, parent) :
return len(parent.nodes)
def getIndexOfChild(self, parent, child):
return parent.nodes.index(child)
def getRoot(self) :
return self.__root
def isLeaf(self, node):
return len(node.nodes) == 0
def addTreeModelListener(self, l):
pass
def removeTreeModelListener(self, l):
pass
def valueForPathChanged(self, path, newValue):
pass
class SQLTreeDemo(JFrame):
Tree demo UI
Displays a tree displaying [hierarchical] results
of a BOM-type SQL query
def __init__(self):
# Get matrix simulating SQL resultset
rows = getSQLRows()
# Convert to custom hierarchical data structure
root = convertRowsToHierarchy(rows)
model = SQLTreeModelAdapter(root)
tree = JTree(model)
sp = JScrollPane(tree)
self.contentPane.add(sp)
self.size = 200, 300
if __name__ == '__main__':
s = SQLTreeDemo()
s.visible = 1 -
Issue with result set of query
I have the following tables:
--soccer.soccer_optical_player_gm_stats
--This is only sample data
GAME_CODE PLAYER_ID NUMBER_OF_SPRINTS
88884 84646 55
88884 64646 15
88884 55551 35
88884 88446 10
etc...--soccer.soccer_optical_team_gm_stats
--This is only sample data
GAME_CODE TEAM_ID
88884 13
88884 13
88884 15
88884 13
etc...--customer_data.cd_soccer_schedule
--sample data
GAME_DATE 5/2/2009 7:30:00 PM
GAME_CODE 88884
GAME_CODE_1032 2009050207
HOME_TEAM_ID_1032 13
HOME_TEAM_ID 5360
HOME_TEAM_NAME Los Angeles
HOME_TEAM_NICKNAME Galaxy
HOME_TEAM_ABBREV LA
AWAY_TEAM_ID_1032 15
AWAY_TEAM_ID 5362
AWAY_TEAM_NAME New York
AWAY_TEAM_NICKNAME Red Bulls
AWAY_TEAM_ABBREV RBSo using the tables above i'm trying to sum the number of sprints for each team and output it...
With the following code:
select distinct
sch.game_date,
tm.team_id,
sch.game_code,
sch.game_code_1032,
sch.home_team_id_1032,
sch.home_team_id,
sch.home_team_name,
sch.home_team_nickname,
sch.home_team_abbrev,
sch.away_team_id_1032,
sch.away_team_id,
sch.away_team_name,
sch.away_team_nickname,
sch.away_team_abbrev,
home_tm_sprints,
away_tm_sprints
-- bulk collect into distance_run_leaders
from
customer_data.cd_soccer_schedule sch,
soccer.soccer_optical_team_gm_stats tm,
select distinct
sum(plyr.number_of_sprints) as home_tm_sprints,
sch.game_code,
sch.home_team_name,
sch.away_Team_name,
sch.game_code,
rank () over (order by sum(plyr.number_of_sprints) desc) as rankings_order_home
from
soccer.soccer_optical_player_gm_stats plyr,
soccer.soccer_optical_team_gm_stats tm,
customer_data.cd_soccer_schedule sch
where sch.season_id = 200921
and tm.team_id = sch.home_team_id
and sch.game_code = plyr.game_code
group by
sch.game_code,
sch.home_team_name,
sch.away_Team_name,
sch.game_code
order by rankings_order_home asc
) home_team,
select distinct
sum(plyr.number_of_sprints) as away_tm_sprints,
sch.game_code,
sch.home_team_name,
sch.away_Team_name,
sch.game_code,
rank () over (order by sum(plyr.number_of_sprints) desc) as rankings_order_away
from
soccer.soccer_optical_player_gm_stats plyr,
soccer.soccer_optical_team_gm_stats tm,
customer_data.cd_soccer_schedule sch
where sch.season_id = 200921
and tm.team_id = sch.away_team_id
and sch.game_code = plyr.game_code
group by
sch.game_code,
sch.home_team_name,
sch.away_Team_name,
sch.game_code
order by rankings_order_away asc
) away_team
where sch.game_code = tm.game_code
and sch.season_id = 200921Issues:
1. The output above returns multiple entries(like 30 or so) for each game_code (i only want two entries returned for each game_code).
--(Only difference between the two result sets is the team_id, which ultimatly lets me know if it a result for the home or away team)
Something like:
GAME_DATE 5/2/2009 7:30:00 PM 5/2/2009 7:30:00 PM
TEAM_ID 13 15
GAME_CODE 88884 88884
GAME_CODE_1032 2009050207 2009050207
HOME_TEAM_ID_1032 13 13
HOME_TEAM_ID 5360 5360
HOME_TEAM_NAME Los Angeles Los Angeles
HOME_TEAM_NICKNAME Galaxy Galaxy
HOME_TEAM_ABBREV LA LA
AWAY_TEAM_ID_1032 15 15
AWAY_TEAM_ID 5362 5362
AWAY_TEAM_NAME New York New York
AWAY_TEAM_NICKNAME Red Bulls Red Bulls
AWAY_TEAM_ABBREV RB RB
HOME_TM_SPRINTS 152 152
AWAY_TM_SPRINTS 452 4522. In addition to that, I'm also having an issue trying to figure out how to do a general ranking...in the from clause i'd so a seperate ranking for just the home teams and just the away the teams. I can't seem to figure out how to merge the rankings into one, and just have one general ranking.
Edited by: user652714 on May 7, 2009 4:18 PM
Edited by: user652714 on May 8, 2009 7:14 AMok maybe I just need to give you a better understanding of what i'm trying to ultimatly do, and maybe that will help clarify things.
In the original code I posted the following subquery in the from clause...
select distinct
sum(plyr.number_of_sprints) as home_tm_sprints,
sch.game_code,
sch.home_team_name as home_team_name,
sch.game_code,
rank () over (order by sum(plyr.number_of_sprints) desc) as rankings_order_home
from
soccer.soccer_optical_player_gm_stats plyr,
soccer.soccer_optical_team_gm_stats tm,
customer_data.cd_soccer_schedule sch
where sch.season_id = 200921
and tm.team_id = sch.home_team_id
and sch.game_code = plyr.game_code
group by
sch.game_code,
sch.home_team_name,
sch.away_Team_name,
sch.game_code
order by rankings_order_home asc the result set was this...
HOME_TM_SPRINTS GAME_CODE HOME_TEAM_NAME GAME_CODE RANKINGS_ORDER_HOME
576 870988 New York 870988 1
480 870991 Chicago 870991 2
435 870945 Chicago 870945 3
416 870983 San Jose 870983 4
402 870961 D.C. 870961 5
322 870972 Columbus 870972 6
236 870957 Columbus 870957 7
215 870986 Kansas City 870986 8
143 870984 Los Angeles 870984 9Here is the other subquery that i had originally posted:
select distinct
sum(plyr.number_of_sprints) as away_tm_sprints,
sch.game_code,
sch.away_team_name away_team ,
sch.game_code,
rank () over (order by sum(plyr.number_of_sprints) desc) as rankings_order_away
from
soccer.soccer_optical_player_gm_stats plyr,
soccer.soccer_optical_team_gm_stats tm,
customer_data.cd_soccer_schedule sch
where sch.season_id = 200921
and tm.team_id = sch.away_team_id
and sch.game_code = plyr.game_code
group by
sch.game_code,
sch.home_team_name,
sch.away_Team_name,
sch.game_code
order by rankings_order_away ascResult rest:
AWAY_TM_SPRINTS GAME_CODE AWAY_TEAM GAME_CODE RANKINGS_ORDER_AWAY
483 870972 Chicago 870972 1
435 870945 New York 870945 2
430 870986 D.C. 870986 3
429 870984 New York 870984 4
402 870961 New England 870961 5
384 870988 San Jose 870988 6
320 870991 New England 870991 7
208 870983 Chivas USA 870983 8
118 870957 Colorado 870957 9Final output that I want/trying to get
TM_SPRINTS GAME_CODE TEAM GAME_CODE RANKINGS_ORDER
576 870988 New York 870988 1
483 870972 Chicago 870972 2
480 870991 Chicago 870991 3
435 870945 Chicago 870945 4
435 870945 New York 870945 4
430 870986 D.C. 870986 6
429 870984 New York 870984 7
416 870983 San Jose 870983 8
402 870961 D.C. 870961 9
402 870961 New England 870961 9
384 870988 San Jose 870988 11
322 870972 Columbus 870972 12
320 870991 New England 870991 13
236 870957 Columbus 870957 14
215 870986 Kansas City 870986 15
208 870983 Chivas USA 870983 16
143 870984 Los Angeles 870984 17
118 870957 Colorado 870957 18The above is what i'm going for...but if it's to difficult to merge the columns into one (instead of having a seprate column for home_team_* and away_team_* that's fine to.
Edited by: user652714 on May 11, 2009 9:04 AM -
Filter by "Result from another query" option not available in Webi
Hi all
I am trying to filter one query by zipcode based on the results of a previously run query in the same report. However this option is not available on the drop down when I drag zipcode into the filter pane. I am restricted to the options: Constant, Value(s) from a list, Prompt or Object.
I have "use subqueries enabled" within my universe and the data is held in an RMDBS (i.e. it is not an OLAP universe) so I expected this functionallity to be available.
I am using XI 3.2 and Java version 1.6.0.15, i.e. up to date.
Any help would be greatly appreciated.
Thanks
SharonSharon,
Here is one method to achieve your objective, however, it involves the use of Merge Dimensions. Here goes:
In the Edit Query mode, build two queries, where the first query has all the objects, to include Zip code, and the second query has the zip code, filtered for the one at hand. (you probably have done this portion already)
In the Edit Report mode, think of your data set as Query1 (all the data objects you want) and Query2 (zip code and filtered on that zip code) and thus you'll have Query1.zip and Query2.zip. If you build a grid containing all the data you want from Query1, then simply add Query2.zip to that grid, voila, the grid will be "filtered" due to the "merge" that occurs under the wire. The 'problem' here is that you have two columns that are repetitive and there is no inherent way to "hide" a column in WebI other than masking the column with white on white (font/borders) or some folks sometimes apply Alterters to achieve the same.
Best of luck in moving forward with your task.
Thanks,
John -
Slide size issues with copy from another project
Working with Captivate 4. I have a completed project where I have a slide I would like to re-use in a new project. The recording options for each project are the same - full screen recording. The image is being cut off all the way around the when I 'Copy Slide' in Project A and 'Paste Slide' in Project B.
If the layout size is the same, why is the image being cropped/adjusted in the Paste? Is there any way to adjust the size of the image when pasting an entire slide into a project?
Thanks in advance,
DHi again
Seems odd. But I may have a workaround. What if instead of copying the slide, you simply insert a Blank slide in the new project? Then you copy the background of the slide from the older one and paste as background into the newer? Results the same then or what?
Cheers... Rick
Helpful and Handy Links
Captivate Wish Form/Bug Reporting Form
Adobe Certified Captivate Training
SorcerStone Blog
Captivate eBooks -
How to compare result from sql query with data writen in html input tag?
how to compare result
from sql query with data
writen in html input tag?
I need to compare
user and password in html form
with all user and password in database
how to do this?
or put the resulr from sql query
in array
please help me?Hi dejani
first get the user name and password enter by the user
using
String sUsername=request.getParameter("name of the textfield");
String sPassword=request.getParameter("name of the textfield");
after executeQuery() statement
int exist=0;
while(rs.next())
String sUserId= rs.getString("username");
String sPass_wd= rs.getString("password");
if(sUserId.equals(sUsername) && sPass_wd.equals(sPassword))
exist=1;
if(exist==1)
out.println("user exist");
else
out.println("not exist"); -
Add a new employee - Connection is busy with results for another command
Hi all,
I try to add a new employee in my SAP Business One system, but I get an error message like that : [Microsoft][SQL Native Client] Connection is busy with results for another command * (HEM5) (HEM5)
So I try to see if I get the same message when I update an employee, and I don't get this message.
Do you have an idea, why I get this error message when I add a new employee ?
Message was edited by:
Marc RiarHello,
I am afraid there maybe two users / workstations using the same user code and one of them is creating (add) and other is update. Try to ask the users/wrokstations.
Another way out is try to run this query :
select * from HEM5
Rgds,
JM
http://groups.yahoo.com/group/SBO_Knowledge_Village
[email protected] -
WHERE using results from another querie
Hi,
Example:
<cfquery name="QUERY 1" datasource="MyDatabase">
SELECT Table1ID, A, B, C
FROM Table1
WHERE A = #Form.A#
<cfoutput query="QUERY1">#A#<br></cfoutput>
It returns:
3
4
<cfquery name="QUERY 2" datasource="MyDatabase">
SELECT Table2ID, A, Z, Y
FROM Table2
WHERE A IN (3,4)
<cfoutput query="QUERY
2">#Table2ID#</br></cfoutput>
It returns:
a
b
c
d
e
f
But if I make QUERY2 as:
<cfquery name="QUERY 2" datasource="MyDatabase">
SELECT Table2ID, A, Z, Y
FROM Table2
WHERE A IN (#QUERY1.A#)
it returns only:
a
b
c
The values a,b,c are the Table2ID's where A=3
The values d,e,f are the Table2ID'a where A=4
How can I make return all values?
Hope you understand.
Thanks
ManelThink about what you are doing for a second. You are
selecting multiple rows of data with your first query. Then you are
using a cfloop to loop through each row returned from that first
query to perform another query that uses the value returned in the
A column. The problem is that you are executing your second query
once for each row returned by your first query, and you really
aren't saving that result anywhere, since each iteration of the
loop causes your cfselect to overwrite your previous results. You
can create a list variable and populate it with the results from
your first query, but I have to ask, unless you need the results
from your first query for something else, why don't you just join
the two tables and use on equery?
Based on what you have, something like this?
<cfquery name="QUERY 2" datasource="MyDatabase">
SELECT T2.ID, T2.A, T2.Z, T2.Y
FROM Table2 T2
INNER JOIN Table1 T1 ON T2.A = T1.A
WHERE T1.A = #Form.A#
</cfquery>
Phil
Maybe you are looking for
-
Whenever I open a new session of Firefox, an error message with the above pops up. This happens since I've changed my email password. How do I fix this? Thanks
-
New Cisco 1921 doesn't display running configuration
Hi All, I've recently received this new Cisco 1921 routers with Cisco CP loaded, so it comes up with the annoying change username and password at first access. I've removed all of those files from the flash memory, and rebooted it, and it came up wit
-
How can I change the install location when installing an App (i.e. Lightroom) from Creative Cloud?
-
How do i update to 10.7
i have operating system 10.6.8 and cannot run icloud but my computer says it doesn't need any software updates. help!
-
Illustrator CS5 shortcuts - don´t work
Hi everyone, after upgrading to CS5 on my work Mac, all of my favourite keyboard shortcuts (which are not custom) seems not to work. Here are the basics functions I´m missing: cmd+space = ZOOM IN tab when resizing objects = keeps the aspect ratio/pro