SELECTing from multiple rows and different tables
Basically, I have a table with a primary key and some other columns of data. The second table has a foreign key that points to the first table then has a columns with related data. I want to write construct a SQL query where one of the columns is the primary key from the first table and the second column is a concatenation of all the rows in the second table that have the same foreign key.
I need this in the form of one SQL statement so that I can use it to create a report in Application Express
Just in case my first post was a bit unclear.
My first table has a primary key, INTERACTION_ID, and several other columns of data.
My second table has a foreign key, INTERACTION_ID, and one extra column, USER_NAME.
There are several rows in the second table that share the same INTERACTION_ID as each interaction can have many user names. I want to construct a SQL query where I pull the interaction id in one column and concatenate all the relevant rows of USER_NAME as the second column.
Similar Messages
-
Reg Selection of Multiple Rows in a Table
Hi all,
I have to select multiple rows from a table and have to display those selected records in another table in the next screen.
The problem is, when I am selecting the records in a table, selection should not be allowed on some records based on a condition. Is it possible with the default selection mode of webdynpro. If so, Please tell me how can we disable the selection of certain records in a table(using the default selection mode provided by webdynpro)
Else, if we have to use check boxes for selection(in case of my problem), please do help me out in how to disable the selection of certain records in a table(using check boxes for selection).
Please help me out. Its urgent...
Reward points guranteed.
Regards,
Murthy.HI Narayana,
Multiple selection property is specific to a table, not for a tableElment(ie. for a row), so u cant set some of the rows as multi selected and some as node
U can use Checkbox for this purpose. Based on the condition u can make the check box as enabled and disabled
To achieve this, Create 2 boolean variables inside table node, one for checkbox value(Let it be <b>CBValue</b> .Bind this to checked property of Checkbox) and other for enabling and disabling Checkbox(Let it be <b>CBReadOnly</b>. Bind this to readonly property of CheckBox).
At the time of creation of table elements, as per the condition, u can control the selection as
IPrivate<View>.I<Table>Node tNode=wdContext.node<Table>();
for(int i=0;i<5;i++)
IPrivate<View>.I<Table>Element tEl=tNode.create<Table>Element();
tNode.addElement(tEl);
tEl.setCBValue(false);//Unchecking Checkboxes initially
if(condition=non selectable)
tEl.setCBReadOnly(true);
else
tEl.setCBReadOnly(false)
Regards
Fahad Hamsa -
Updating data from multiple rows in a table view
Hello,
so far in my OAF programming, I have always selected one particular row from a table and saved from it. Now I have a requirement where in my table, fields from more than one row shall have to be updated.
Can anyone please let me know how to accomplish this.
Regards
HawkerHi Prince,
currently I am selecting one row from the table and rendering a region at the top of the table and capturing the user entered data with the following code:
ViewObjectVOImpl vo = getViewObjectVO1();
Row CurrentRow = vo.getCurrentRow();
//After this I perform the checks like user entered value is not null or check input as per business logic.
if(CurrentRow.getAttribute("attributeName") ==null){
//Add what message you want to display
//Add other business logic.
After making all the checks, i commit it.
getOADBTransaction().commit();
Now in my new page I am capturing the user input in the table itself like an excel sheet. Suppose there are ten rows in my advanced table on my page, and each row has one editable field. I have one save button at the bottom of the table.
Now on clicking the save button I have to capture the user input, check whether there is any null value and if all the entered data is correct then only I should commit it.
Can you please let me know how we can accomplish that.
Regards
Hawker -
SELECT from multiple columns and CMP -- possible?
Hello,
Is it possible to write a findByXX() method that will return data from
multiple tables using CMP? If so, are there any examples of how to do
this?
Thanks.Plus, the TopLink EJBs will only work with weblogic.
"Manny Celi" <[email protected]> wrote in message
news:[email protected]..
At this point in time, TopLink is most probably a choice, although it is avery
expensive choice ($5,000.00 per developer), but it also depends on whatversion
of Java you are using.
As I understand, the new version of the EJB 2.0 will feature mappingfeatures,
similar to that of TopLink, although the people from WebGain claim thatthe new
EJB 2.0 specifications will not be as powerful as TopLink.
You can create your own mappings by creating objects that will map to your
result sets. It takes some work, but its not too bad, you will need toincrease
the timelines.
The avantage to using a tool like TopLink, or Gemstone's product, is thatthey
provide Wizards that take you step by step to creating the mappings. The
disadvantage is the "proprietary" code that you have to implement. Thelearning
curve is also steep.
I don't know if I have help, but good luck.
Manny
[email protected] wrote:
Thanks.
But I would like to know if this is possible using only the Weblogic
server
and the J2EE technologies.
Senthil Kumar S wrote:
U can use TOPLink..
http://www.webgain.com
[email protected] wrote:
Hello,
Is it possible to write a findByXX() method that will return data
from
multiple tables using CMP? If so, are there any examples of how todo
this?
Thanks. -
How to create XML from multiple rows in a table?
Hi All,
I have a table where it has multiple rows as below which I need to send as a XML.. can any one let me know how to create?
Table:
PRDID,NAME,DESCRIPTION,SUPPLIER,PRICE
2012,AAA,ADESC,SUPPLIER1,1.8
2012,AAA,ADESC,SUPPLIER2,2.5
XML should be :
<ROOT>
<PRDID>2012</PRDID>
<NAME>AAA</NAME>
<DESCRIPTION>ADESC</DESCRIPTION>
<PRICE>
<REGION>SUPPLIER1</REGION>
<PRICE>1.8</PRICE>
<REGION>SUPPLIER2</REGION>
<PRICE>2.5</PRICE>
</PRICE>
</ROOT>
Thanks
RajeevHi
This white paper shows how to do it - http://www.sdn.sap.com/irj/boc/index?rid=/library/uuid/101c974c-11f9-2b10-4da5-cd350b7eeda0
Michael -
How can i select some row from multiple row in the same group of data
I want to select some row from multiple row in the same group of data.
ColumnA
Column B
1 OK
1 NG
2 NG
2 NG
3 OK
3 OK
I want the row of group of
ColumnA if ColumnB contain even 'NG'
row , select only one row which Column B = 'NG'
the result i want =
ColumnA Column B
1 NG
2 NG
3 OK
Thank youThat's some awful explanation, but I think this is what you were driving at:
DECLARE @forumTable TABLE (a INT, b CHAR(2))
INSERT INTO @forumTable (a, b)
VALUES
(1, 'OK'),(1, 'NG'),
(2, 'NG'),(2, 'NG'),
(3, 'OK'),(3, 'OK')
SELECT f.a, MIN(COALESCE(f2.b,f.b)) AS b
FROM @forumTable f
LEFT OUTER JOIN @forumTable f2
ON f.a = f2.a
AND f.b <> f2.b
GROUP BY f.a -
Selecting multiple rows in a table
Hi All,
I have one problem with selecting multiple rows in a table.I tried with setting table property-selectionMode as Multi, but i dinn't get the solution.
please provide me solution for this.
Thanks & Regards,
Sreelakshmi.HI
Int leadSelection = wdcontext.nodemodelnode.getLeadSelection();
for(int i=0;i<wdcontext.nodeModelNode.size;i++)
if(wdcontext.nodeModelNode.isMultiselected(i) || leadSelection ==i)
String name = wdcontext.nodemodelnode.getnameelementatindex(i).getName();
String address = wdcontext.nodemodelnode.getaddresselementatindex(i).getAddress();
String age = wdcontext.nodemodelnode.getAgeelementatindex(i).getAge();
Create a method for the Table Property onLeadSelect() where you can open a popup window
Create a value node and with attributes same as Table attributes and then set the values of the table
to the value node attributes.
Thanks -
Selecting from multiple tables, into one internal table
Hi,
What is the best & most efficient method of selecting from multiple table (in my case 6,) into one internal table?
Thanks,
John
Points will be rewarded and all responses will be highly appreciated.I have simple example :
First one - Join 5 tables
data : f1 type i,
f2 type i,
f3 type i.
start-of-selection.
get run time field f1.
write the query 4 or 5 tables join.
get run time field f2.
f3 = f2 - f1 ( Total time).
Second one - joins 3 table and use for all entries
data : f1 type i,
f2 type i,
f3 type i.
start-of-selection.
get run time field f1.
write the query 3 tables join and use for all entries
get run time field f2.
f3 = f2 - f1. ( Total time )
Finally you can have time diffrence between the both sql statement. -
Selecting multiple rows of a table
Hi Forum,
How to select multiple rows of a table at a time? Please help me..
Thanks
SwapnaHi Swapna,
To select more then one row in table, just set the selectionmode property of table to 'multi' or 'auto' and also change the selection property of the node (to which table is binded) to 0:n.
I hope it helps.
Regards
Arjun
Edited by: Arjun on Feb 4, 2009 11:52 AM -
TO DRAW A TABLE WITH MULTIPLE ROWS AND MULTIPLE COLOUMNS IN FORM
Hi,
How to draw a table with multiple rows and columns seperated by lines in form printing?check this
http://sap-img.com/ts003.htm
Regards
Prabhu -
Is selecting from a view more efficient than selecting from multiple tables
Hi heres the problem
Lets say i created a view from 2 tables (person and info). both have a ID column
create view table_view (age,name,status,id) as
select a.age, a.name, b.status, b.id
from person a, info.b
where a.id=b.idif i want to select a given range of values from these 2 tables which of the following queries would be more effective.
select a.age, a.name, b.status, b.id
from person a, info.b
where a.id=b.id
and a.id <1000
select age, name, status, id
from table_view
where id <1000Bear in mind that this concept of views storing the SQL text is something relative to Oracle databases and not necessarily other RDBMS products. For example, Ingres databases create "views" as tables of data on the database and therefore there is a difference between selecting from the view and selecting from the base tables.
Oracle also has "materialized views" which differ from normal "views" because they are actually created, effectively, as tables of data and will not use the indexes of the base tables.
In Oracle, you cannot create indexes against "views" but you can create indexes against "materialized views". -
Hi,
a) I want to read EACH VALUE from a spreadsheet file having multiple rows and columns WITH DELAY. I am attaching my VI and sample datalog file for reference (tempsensor.txt).I need to do so because as soon as I read put ON the Sensor button on front panel, LV reads all the values at one go. I need the values for each temperature to be displayed after a delay.
b) Secondly, I would like to read another file containing the state of four antennas (deployed:1; undeployed:0). I am logging state of each antenna in each column of the file(magnet.txt) I need to have four LEDS on front panel to display state of the antennas. I dont know what I have done for antennas in my VI is right or wrong. I guess thats rhe wrong way to approach the problem. Please help!!!(column1: Antenna1 state ; Column2:Antenna2 state.. and so..on..)
Any help would be greatly appreciated!!
Thanks in advance,
Ratnesh
FYI: The first column in my datalog file represents timestamp(number of seconds elapsed), second column: reading for temperature sensor 1, third column: reading for temperature senosr 2, and so on. I am using approx. 11 temperature sensors.
Also, I have generated the log files for the reference purpose only. They do not represent the actual values. They are far away from actual values.
Attachments:
01032005.zip 30 KBLook at this modified version of your VI. After looking at it, I determined that a shift reggister was not required in this case.
Lynn
Attachments:
MultiSensors.2.vi 85 KB -
How to save data from JTable multiple rows and columns
Hi Y_Not thanks for your help before...
But what should I do if I want to get/save many data from many column and rows??i don't quite understand your (repeated) question. what is the problem with "multiple rows and columns". Y_NOT and i have shown you ways to access them.
all you need are 2 loops: one around your number of rows and one around the number of columns or vice versa depending in which order you want to save things:
for (int col = 0; col < data.size(); col++) {
for (int row = 0 ; row < data[col].size(); row++) {
// save your data
saveData(data[col].getElementAt(row));
// or use yourtable.getValueAt(row, col);
}this is not a problem of Swing/Java but of simple algorithm...
thomas -
Hi,
I am doing select from multiple tabels (2) in one SQL query.
How to get the result as it says.. Column name is incorrect ?
thanks,
-rajtreat the resultset as noraml. You get it in sequence as you have specified the column names. You use rs.getXXX(index) instead of columnname
-
Update multiple row for different values
hi,
Please provide me the sql query to update multiple row in a table with different values.
i need to change the old date to new date
we have only 3 column id,name,old date.now i need to update the old date to new date
ID name old date new date
1 A 2012-12-20 12/7/2012
2 B 2012-12-20 12/9/2012
3 c 2012-12-20 12/5/2012
thank you.Here are two ways to do this. Thanks to ranit for the table creation script, which I adapted.create table test_x
as
select 1 id, 'A' name, to_date('2012-12-20','yyyy-mm-dd') old_date
from dual UNION ALL
select 2 id, 'B' name, to_date('2012-12-20','yyyy-mm-dd') old_date
from dual UNION ALL
SELECT 3 ID, 'C' NAME, TO_DATE('2012-12-20','yyyy-mm-dd') OLD_DATE
from dual;First method using MERGE:MERGE INTO TEST_X O
USING (
select 1 id, to_date('12/7/2012','mm/dd/yyyy') new_date
from dual UNION ALL
select 2 id, to_date('12/9/2012','mm/dd/yyyy') new_date
from dual UNION ALL
SELECT 3 ID, TO_DATE('12/5/2012','mm/dd/yyyy') NEW_DATE
FROM DUAL
) n
ON (O.ID = N.ID)
WHEN MATCHED THEN UPDATE SET OLD_DATE = n.NEW_DATE;Second method using UPDATE:UPDATE TEST_X SET OLD_DATE =
CASE WHEN ID = 1 THEN TO_DATE('12/7/2012','mm/dd/yyyy')
WHEN ID = 2 THEN TO_DATE('12/9/2012','mm/dd/yyyy')
WHEN ID = 3 THEN TO_DATE('12/5/2012','mm/dd/yyyy')
END
where id between 1 and 3;
You probably don't want to use these methods.*
You say the "user" will enter these values. Will he always enter exactly 3 values?
The "user" will enter values into a screen I suppose. What language is the user interface programmed in?
Maybe you are looking for
-
Exception when trying to acess a jsf application
Im using eclipse 3.3 , tomcat 5.5.2x index.jsp ======== <html> <body> <jsp:forward page="faces/ourJsf/enterAge.jsp" /> </body> </html> ============ enterAge.jsp ========= <%@ page contentType="text/html; charset=Cp1252" %> <%@ taglib uri="http://java
-
CONVERSION_EXIT_ALPHA_INPUT problem
Hi, I am adding leading zeros to a number using the CONVERSION_EXIT_ALPHA_INPUT Function module. But i am not getting what i require in case of a negative number. Eg: I am getting perfectly correct result in case of postive numbers. input = 1500 outp
-
I am generating an XML file dynamically using php, and have flex call and use it as a dataprovider. However I have been unable to make flex display the updated data, it just continues displaying the data that was first genereated in the XML file. I h
-
Merge photos from starter edition to another edition on same computer
I have both Adobe Photoshop Album 3.0 starter edition and Adobe 2.0 Photoshop on my PC. I accidentally downloaded some pictures from my camera onto the 3.0 edition (I primarily use the 2.0 edition). Is there any way to move the pictures in the 3.0 al
-
What I want to do is plot time vs temperature with two y-axis. The first axis (on the left) is deg-C and the second axis (on the right) is deg-F. If I rescale one axis, I want the other to rescale accordingly. I tried plotting time vs deg-C, then com