How to select match data in one row
hello,
here is my query and its output
select stud.si_roll_no, stud.si_name, stud.si_father_name,stud.si_class, stud.si_father_nic_no ,sp.spi_amount,sp.spi_paid_date from si_student_info stud inner join spi_student_package_info sp on sp.spi_roll_no= stud.si_roll_no where stud.si_roll_no = 'IC10326'
"OUTPUT"
IC10326 MUNEEB JAVIAD KHAN JAVEED KHAN 901 25000 12-AUG-09
IC10326 MUNEEB JAVIAD KHAN JAVEED KHAN 901 12500 07-OCT-09
IC10326 MUNEEB JAVIAD KHAN JAVEED KHAN 901 12000 07-DEC-09
IC10326 MUNEEB JAVIAD KHAN JAVEED KHAN 901 13250 26-APR-10
IC10326 MUNEEB JAVIAD KHAN JAVEED KHAN 901 16800 23-AUG-10
IC10326 MUNEEB JAVIAD KHAN JAVEED KHAN 901 5000 06-SEP-10
IC10326 MUNEEB JAVIAD KHAN JAVEED KHAN 901 7000 06-DEC-10
IC10326 MUNEEB JAVIAD KHAN JAVEED KHAN 901 15300 15-FEB-11
whereas i want to the output looks like this
IC10326 MUNEEB JAVIAD KHAN JAVEED KHAN 901 25000 12-AUG-09 12500 07-OCT-09 12000 07-DEC-09 13250 26-APR-10 and so on
is there any function that can do that or any smart way to handle this ?
with the use of aggregate functions we can get the required output here.
select * from
(select si_roll_no, si_name, si_father_name,si_class,
si_father_nic_no ,spi_amount,spi_paid_date,
Lead(spi_amount,1,NULL) OVER (PARTITION BY si_roll_no order by ROWNUM) ,
Lead(spi_paid_date,1,NULL) OVER (PARTITION BY si_roll_no order by ROWNUM) ,
Lead(spi_amount,2,NULL) OVER (PARTITION BY si_roll_no order by ROWNUM) ,
Lead(spi_paid_date,2,NULL) OVER (PARTITION BY si_roll_no order by ROWNUM) ,
Lead(spi_amount,3,NULL) OVER (PARTITION BY si_roll_no order by ROWNUM) ,
Lead(spi_paid_date,4,NULL) OVER (PARTITION BY si_roll_no order by ROWNUM)
FROM
(select stud.si_roll_no, stud.si_name, stud.si_father_name,stud.si_class,
stud.si_father_nic_no ,sp.spi_amount,sp.spi_paid_date,count(*) over ()
from si_student_info stud inner join spi_student_package_info sp
on sp.spi_roll_no= stud.si_roll_no
where stud.si_roll_no = 'IC10326'))
where rownum < 2;
Thanks,
Pavan
Similar Messages
-
How to display Column data in one row
Hello,
I have one Employee with 4 effective date displayed in one column. Effective date is drived by Reason of : New Hire, Rehire, Transfer etc.
I want to show the effective dates for one reason in one single row. For example a person was rehired 4 times it will show as
1006555 6/12/2006 1/2/2007 6/11/2007 5/12/2008 12/29/2008 5/17/2010
It's currntly showing as:
AUDITEFFECTIVEDATE_3
6/12/2006
1/2/2007
6/11/2007
5/12/2008
5/17/2010Well that's a little tougher... For a solution to work, you're going to need to find a way to differentiate between the the specific hiring events. Without seeing what data is available, I'd say start looking at the use of running totals... or in this case a running count.
Set it up to reset on EmployeeID and count each "event", incrimenting up with each instance.
Then your formula would look more like this...
IF {EventType} = "Rehire" AND {#RTotal1} = 1 THEN AUDITEFFECTIVEDATE_3
IF {EventType} = "Exit" AND {#RTotal1} = 1 THEN AUDITEFFECTIVEDATE_3
IF {EventType} = "Rehire" AND {#RTotal1} = 2 THEN AUDITEFFECTIVEDATE_3
IF {EventType} = "Exit" AND {#RTotal1} = 2 THEN AUDITEFFECTIVEDATE_3
IF {EventType} = "Rehire" AND {#RTotal1} = 3 THEN AUDITEFFECTIVEDATE_3
IF {EventType} = "Exit" AND {#RTotal1} = 3 THEN AUDITEFFECTIVEDATE_3
IF {EventType} = "Rehire" AND {#RTotal1} = 4 THEN AUDITEFFECTIVEDATE_3
IF {EventType} = "Exit" AND {#RTotal1} = 4 THEN AUDITEFFECTIVEDATE_3
This issue then becomes an issue of space on the report. You end up wasting 1/2 of your horizontal space trying to allot for one odd ball... You'll also get to re-work the report if the same employee goes for rounds 5, 6 or 7...
HTH,
Jason -
Hello,
Tell Me how i can show a single column data in one row.
10
20
30
To
10,20,30If you are OK with displaying comma separated list or column data you could:
SQL> select ltrim(sys_connect_by_path(ename,','),',') ename_list
2 from (
3 select ename,
4 row_number() over(order by 1) rn,
5 count(*) over() cnt
6 from emp
7 )
8 where rn = cnt
9 start with rn = 1
10 connect by rn = prior rn + 1
11 /
ENAME_LIST
SMITH,ALLEN,WARD,JONES,MARTIN,BLAKE,MILLER,SCOTT,KING,TURNER,ADAMS,JAMES,FORD,CLARK
SQL> To display as separate columns you would need to either know number of rows:
SQL> select min(case rn when 1 then ename else null end) ename1,
2 min(case rn when 2 then ename else null end) ename2,
3 min(case rn when 3 then ename else null end) ename3,
4 min(case rn when 4 then ename else null end) ename4,
5 min(case rn when 5 then ename else null end) ename5,
6 min(case rn when 6 then ename else null end) ename6,
7 min(case rn when 7 then ename else null end) ename7,
8 min(case rn when 8 then ename else null end) ename8,
9 min(case rn when 9 then ename else null end) ename9,
10 min(case rn when 10 then ename else null end) ename10,
11 min(case rn when 11 then ename else null end) ename11,
12 min(case rn when 12 then ename else null end) ename12
13 from (
14 select ename,
15 rownum rn
16 from emp
17 )
18 /
ENAME1 ENAME2 ENAME3 ENAME4 ENAME5 ENAME6 ENAME7 ENAME8 ENAME9 ENAME10 ENAME11 ENAME12
SMITH ALLEN WARD JONES MARTIN BLAKE CLARK SCOTT KING TURNER ADAMS JAMES
SQL> or use dynamic SQL.
SY. -
Hello ---
I have an array of data, I would like to be displayed all the data in one row.<tr></tr>, how to do this?
If I use <h:table> <column></column></h:table>, it will display different rows.
Thanks!
BenPopulate the components in the backingbean. Try something like:
JSF<h:panelGrid binding="#{myBean.grid}" />MyBeanprivate List arrayOfData;
private HtmlPanelGrid grid; // + getter + setter
private void populateGrid() {
grid = new HtmlPanelGrid();
grid.setColumns(arrayOfData.size());
for (Iterator iter = arrayOfData.iterator(); iter.hasNext();) {
Object value = iter.next();
HtmlOutputText text = new HtmlOutputText();
text.setValue(value);
grid.getChildren.add(text);
} -
How do I transfer data from one iPhone to another?
How do I transfer data from one iPhone to another?
If your old device is an Apple using iOS 5 or later, and you have an iCloud account, you can transfer all your saved messages, email accounts, photos, notes, and other personal settings to your new iPhone.
Here's how...
Connect your old Apple device to WiFi and to a power source.
Back it up to iCloud by going to Settings > iCloud > Storage & Backup and toggling iCloud Backup on. The time it takes to ba ckup depends on how much data you have and on the speed of your internet connection.
iCloud backs up your device once a day. If it needs backing up before you transfer to your new iPhone 5, tap Back Up Now in Settings > iCloud > Storage & Backup. Do not start transferring before the backup is finished.
Turn on your new iPhone and complete the setup by selecting your language and country, and choose whether to enable Location Services. When prompted, choose your WiFi network.
When prompted to set up, choose Restore from iCloud Backup, tap Next, and enter your Apple ID and password.
Select the backup of your old device and tap Restore. Wait until the device has finished restoring from the backup.
When the restore process is complete, your iPhone will restart and be ready to use.
Connect your iPhone 5 to iTunes to sync data not contained in the backup (such as music, videos, apps, and so on). You can choose the data that are synced by clicking the syncing tabs in iTunes. -
How to select multiple data without select options?
Dear experts,
I have a rquirement that i have a one selection screen and in that selection screen on date field is there which is parameter type. we using this parameter date field in the program for selecting data..after that i am using the logic to multiple value..now my requirement is how to select the data for multiple value..
PARAMETERS : SO_DATE TYPE SY-DATUM OBLIGATORY.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
DATE = so_date
DAYS = 1
MONTHS = 0
SIGNUM = '-'
YEARS = 0
IMPORTING
CALC_DATE = so_date
l_cm_first+0(6) = so_date+0(6). " month & year
l_cm_first+6(2) = '01'. " date
l_cm_end = so_date.
my requirement is that how to use l_cm_first and l_cm_end multiple selection in select query ??
eg- i want to fetch the data from 1/8/2014 to 11/08/2014 using this field l_cm_first and l_cm_endl_cm_first+0(6) = so_date+0(6). " month & year
l_cm_first+6(2) = '01'. " date
l_cm_end = so_date.
after executing this line l_cm_first = 1/8/2014 and l_cm_end = 11/08/2014
now i have to select in this range how to do it? -
How do I make data from one Table flow into a separate Table
How do I make data from one Table flow into a separate Table in iworks numbers?
Great stuff Yvan,
KOENIG Yvan wrote:
Here you may see the way to transfer the contents of a column of Table A in a column of Table B
I used two kinds of formulas.
In the cell A2 of Table B
the formula is :
=Table A :: $B2
It may be :
=Table A :: $B
Apply Fill Down
Copy paste it in cell A1 which is in a header row.
This formula does its duty but it’s not robust enough and will not survive to a Sort.
This is why in B2, I inserted a more robust formula :
=OFFSET(Table A :: $A$1,ROW()-1,2)
You will find details about the functions used in Numbers User Guide delivered with every copy of iWork ‘08
Yvan KOENIG (VALLAURIS, France) samedi 6 août 2011 17:45:22
iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.0
My iDisk is : <http://public.me.com/koenigyvan>
Please : Search for questions similar to your own before submitting them to the community
To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !
The first suggestion was the simple answer I needed,
Thank you -
How do you delete more than one row on numbers?
how do you delete more than one row on numbers?
Hi operatorcarmax,
Select the Rows (shift click works for me). Then hover the cursor over any selected Row label to see the upside-down triangle. Click on it to see a Pop-up menu.
The Numbers User Guide is available for download under the Numbers Help Menu. A good read.
Regards,
Ian. -
How to move BCS data from one box to other
Hello Expert,
Dose any one know how to move BCS data from one box to other box ?
Thanks & Regards,1) The best is to do the test. In my case, my customer was just doing this transfer (in full) to perform tests on the BEX reportings. Actually, they never raised any issue regarding document number when they did additional postings in test system... I would also say that during the transfer, the number counter in Qual gets not synchronized with the one in Prod. So, I think the system will just take the next number available in Qual. Should not be an issue.
2) As explained in answer 1), in my case, the purpose was not to perform data migration from one system to the other one. Thus, my customer never performed a subsequent consolidation in the target system. But, basically, the transfer copies all data : posting levels 00 to 30, for all periods you have selected + Additional financial data and sequence of activities. Thus, for me, everyhting is available in the target system, including COI documents. In other words, the "picture" regarding the data should be exactly the same between both system. The only thing you need to pay attention to is the customizing : it must be the same in Qual and Prod (example : date of acquisition and divestiture, structure of the group, etc...).
Another very important thing, is that your export data source must not be enriched due to the BCS Delta load scenario. If it is the case, the system will write the consolidation logic (i-e the consolidation group + reporting mode) when transferring the data from the source Real Time Infocube to the Target Real time infocube, which will lead to inconsistent data in the target system. -
How can I Move data from one column to another in my access table?
I have two columns, one that stores current month’s data and one that stores last month’s data. Every month data from column 2 (this month’s data) needs to be moved to column 1 that holds last month’s data. I then null out column 2 so I can accumulates this month’s data.
I understand how to drop a column or add a column, how do I transfer data from one column to another.
Here is my trial code:
<cfquery name="qQueryChangeColumnName" datasource="#dsn#">
ALTER TABLE leaderboard
UPDATE leaderboard SET points2 = points3
</cfquery>
Unfortunately, I get the following error:
Error Executing Database Query.
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error in ALTER TABLE statement.
How can I transfer my data with the alter table method?I looked up the Access SQL reference (which is probably a
good place to start when having issues with Access SQL), and
it suggests you probably need a WHERE clause in there.
I agree the documentation is a good place to start. But you should not need a WHERE clause here.
Too few parameters. Expected 1.
If you run the SQL directly in Access, what are the results? At the very least, it should provide a more informative error message.. -
How do i transfer data from one internal tabe to another.
Hi All,
How do i transfer data from one internal tabe to another.
Can i do it ebven if he tables are different in structure.
Please Advice.
Thanks in advance.Hi Saket Tiwari,
I hope the earlier post by kashyap is good enough an answer. anywas in addition to it let me give a detailed
explanation of how you can populate an internal table.
1) Append data line by line.
Syntax : APPEND [<wa> TO / INITIAL LINE TO] <itab>.
this appends new line to internal table <itab>.
2) Using COLLECT statement.
COLLECT is another form of statement used for populating the internal tables. Generally COLLECT is used while inserting lines into an internal table with unique standard key. The syntax for COLLECT statement is as shown
Syntax : COLLECT [<wa> INTO] <itab>.
3) Using INSERT statement
Syntax INSERT [<wa> INTO / INITIAL LINE INTO] <itab> [index <idx>].
INSERT statement adds a line/work area to the internal table. You can specify the position at which the new line is to be added by using the INDEX clause with the INSERT statement.
Now coming to your request..
To append part or all of an internal table
Syntax
APPEND LINES OF <itab1> [FROM <n1>] [TO <n2>] TO <itab2>.
* Note:
Without the FROM and TO options, this statement appends the entire table <itab1> to <itab2>.*
b) To insert part or all of an internal table into another internal table
Syntax
INSERT LINES OF <itab1> [FROM <n1>] [TO <n2>]
INTO <itab2> [INDEX <idx>].
c) Using Move statement.
To copy entire contents of one table into another in one execution
Syntax MOVE <itab1> To <itab2>.
OR
<itab1> = <itab2>.
but u hav to be careful because he contents of itab2 will eb overwritten on the execution of this statement.
These copy the contents of ITAB1 to ITAB2. Incase of internal tables with header line we have to use [] inorder to distinguish from work area. So, to copy contents of internal tables with header line the syntax becomes,
ITAB1[] = ITAB2[].
Coming to the letter part of your question, Yes, we can copy values between tables having different structures.
for this we use
MOVE-CORRESPONDING <itab1> TO <itab2>
this executes the statement for their header lines. Searches for the sub-fields which occur both in itab1 and itab2 and then generates, for all relevant field pairs which correspond to the
sub-fields ni , statements of the form MOVE itab1-ni TO itab2-ni. The other fields remain unchanged.
I hope the information provided has been of your help.
Reward if useful.
Regards,
Jose -
How do I transfer data from one exterior harddrive to another?
How do I transfer data from one exterior harddrive to another when they are both connected to our Imac Desktop?
Depends what you want to transfer...
A few more Details about what you are trying to achieve would be good. -
How to select the data from a Maintainance View into an internal table
Hi All,
Can anybody tell me how to select the data from a Maintainance View into an internal table.
Thanks,
srinivas.HI,
You can not retrieve data from A mentenance view.
For detail check this link,
http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ed2d446011d189700000e8322d00/content.htm
Regards,
Anirban -
How can you transfer data from one ipod to another ?
How can you transfer data from one ipod to another ipod ?
The geniusbar told me what to do, I understood but there is still a problem for me >:/ It's not showing up though. Like "device." Nothing is happening, and I tried as soon as I got home. Then after half an hour, then an hour, then 3 hours. My problem is that it's not showing up! It's stuck in recovery mode! There's still like 25% battery. So I have no idea why.
-
How do i backup data from one iphone to another
how do i backup data from one iphone to another?
Back up your old phone, then restore your new one from the backup. See http://support.apple.com/kb/HT2109.
Maybe you are looking for
-
Tracks appearing in a random order
OK, I'm a massive fan of a band called Feeder, and I've put all of their B-sides onto my computer. Now, I've numbered the tracks to relate to the dates they were released (1-58) and put them in an album entitled "B sides", but when I sort by "artist"
-
Hi all, I need to start a Workflow at user exit RGGBS000. I know that I need to do a copy of this program ( ZRGGBS000). But I don´t know how to implement on there. I only need to call this function like this: *Calls Workflow call function '
-
Why is Aperture ignoring effects selected in iPhone?
I just noticed that all the effects like Chrom, Old, Transfer etc that one can select in the iPhone when taking a picture are ignored once the pictures are coming into the Photostream in Aperture. Is there a setting somewhere to keep those effects? T
-
FIOS router causing static and popping noises on computer audio
Hi, I'm a less than two week old FIOS internet user and am loving the speed and service but I have one problem. The FIOS router seems to be causing static popping noises my desktop computers audio that is connected to the FIOS router by the yellow Et
-
I have PSE9 that I run on an I-mac quad core with 8mg of ram. Anytime I load a media card and try to use photo downloader the program frezzes when I try to change the location that I want to save the photo to. I've read a few forum threads that sugge