Please help with an sql to show more than one records into single row for each student

From the following data I would like to create an sql to get the information  as the following layout
studentid,  firstTerm,  EnglishMark1,ScienceMark1,MathsMark1, Secondterm,EnglishMark2,ScienceMark2,MathsMark2,
ThirdTerm,EnglishMark3,ScienceMark3,MathsMark3 // As single rows for each student
Example
1 First, 30,40,20,Sec,30,40,20,  simillarly next row for next row for another sudent. Please help to generate the sql for the same.
Please help it would be very appreciate.
With Thanks
Pol
polachan

create table yourdata (studentid int, term varchar(10), section varchar(50), Mark int)
insert into yourdata values
(1,'First','Math',20),(1,'First','English',30),(1,'First','Science',40),
(2,'First','Math',20),(2,'First','English',30),(2,'First','Science',40),
(3,'First','Math',20),(3,'First','English',30),(3,'First','Science',40),
(1,'Sec','Math',20),(1,'Sec','English',30),(1,'Sec','Science',40),
(2,'Sec','Math',20),(2,'Sec','English',30),(2,'Sec','Science',40),
(3,'Sec','Math',20),(3,'Sec','English',30),(3,'Sec','Science',40)
Select studentid
,max(case when term='First' and section='English' Then Mark End) as EnglishMark1
,max(case when term='First' and section='Science' Then Mark End) as ScienceMark1
,max(case when term='First' and section='Math' Then Mark End) as MathMark1
,max(case when term='Sec' and section='English' Then Mark End) as EnglishMark2
,max(case when term='Sec' and section='Science' Then Mark End) as ScienceMark2
,max(case when term='Sec' and section='Math' Then Mark End) as MathMark2
,max(case when term='Third' and section='English' Then Mark End) as EnglishMark3
,max(case when term='Third' and section='Science' Then Mark End) as ScienceMark3
,max(case when term='Third' and section='Math' Then Mark End) as MathMark3
From yourdata
Group by studentid
drop table yourdata

Similar Messages

  • How to show more than one record at a form-like style report?

    Hi All,
    I developed a form-like style report
    I want it to show more than one record at once (At the same page)
    I tried that by setting the value to "Maximum records per page" property for the repeating frame to 10
    but when I close the property palete and open it agian the value is returned to 1 !!!
    how to show more than one record at the same page?????
    Thank u

    Hi,
    there's perhaps another property like "page protect". If than 2 records didn't fit at one page there's a page break. Or is there any object inside the repeating frame with page-break properties? Sorry .. it's like looking into a chrystal ball ...
    Regards
    Rainer

  • Wanted to catch more than one record in selected rows

    Hi all,
    I am using the following function to catch the selected rows.
    CALL METHOD w_grid->get_selected_rows
            IMPORTING
              et_index_rows = i_selected_rows.
    it is catching only one row.
    but i want to catch more than one record.
    for example i will select more than one record from the grid and press the approve button. so that the status will change in the database.
    but what is happening is if i select 2 or more records it is approving only first record. because in the i_selected_rows only first row is catching. what i have to do to catch other select rows also.
    thanking u.
    regards,
    giri.

    Hi,
    CALL METHOD w_grid->get_selected_rows
    IMPORTING
    et_index_rows = i_selected_rows[] ."<<<< try to put these into []
    please not open multiple threads

  • Master_detail for more than one record at a time

    Hi,
    How can i display master_detail records for more than one records at a time, for example, i have two tables A and B , A has username and role and B has username and profile. here i wanted to display 10 users at a time on my 6i form with username, role and profile.
    i have created a master-detail relation ship with these tables when i'm executing F8 on blcok A , it displays 10 records on BlockA but, only one at a time on block B, how can i display all corresponding records on block B at a time.
    Thanks for your help.Bcj

    Thanks Roberts, that was realy informative due to some doubts i would like to confirm my requirements , i have two blocks A and B and each master record has only one detail record. but i wanted to display at least 10 master_detail relationships(records) on the form at a time, i would like to know is it possible to do without creating any table or view for example,
    data in table A,
    username role
    AAA R1
    BBB R2
    CCC R3
    data in table B,
    username profile
    AAA P1
    BBB P2
    CCC P3
    i wanted to display it on form like below,
    username role profile
    AAA R1 P1
    BBB R2 P2
    CCC R3 P3
    Also would like to know that how can i select data from dba_users, any restriction is there on forms 6i, i can select it on sqlplus.
    Thanks Again, Bcj

  • HT1277 I have OS X 10.9.2 and have downloaded maverick. If I am sending an email message to one person, options for addresses  from my address book show up. However if I want to send it to more than one person, the address options for the others do not sh

    I have OS X 10.9.2. and have downloaded Maverick. If I am sending an email message to one person, options for addresses from my Address Book appear. However if I want to send it to more than one person, the potential addresses for the other persons do not show. Can you please help?

    Install ClamXav and run a scan with that. It should pick up any trojans.   
    17" 2.2GHz i7 Quad-Core MacBook Pro  8G RAM  750G HD + OCZ Vertex 3 SSD Boot HD 
    Got problems with your Apple iDevice-like iPhone, iPad or iPod touch? Try Troubleshooting 101

  • How to show more than one report in a same Viewer or Form

    Dear all,
    I have develop many reports with CrystaReport XI and I'm using the CrystalReportViewer to show each of them in VB6. My Question is: Can I show more than one report in a same Viewer? if i need to show the report1.rpt and report2.rpt in a same window how can I do it?
    Sérgio Salazar - Brazilian VB developer

    No and Please re-post if this is still an issue to the Legacy Application Development SDKs Forum or purchase a case and have a dedicated support engineer work with you directly

  • How to show more than one report in a same Form

    Dear all,
    I have develop many reports with CrystaReport XI and I'm using the CrystalReportViewer to show each of them in VB6. My Question is: Can I show more than one report in a Viewer? if i need to show the report1.rpt and report2.rpt in a same window how can I do it?
    Sérgio Salazar - Brazilian VB developer

    I once had a project which involved alot of reports and on my mind I had the same idea; to display all reports with only one crviewer but was not able to. Instead what Idid was to create say 10 forms with a viewer on each and if the user wanted to produce extra reports, they had to close some of them. This worked out for me.

  • Show to show more than one persona...

    is it possible to show to show more than one persona with FF Android?
    to bad the address bar is in the way, this should be transparent or lower..
    André

    FF Android should have a "persona rotator" or something, to show more than one...

  • Cant listen to more than one song in a row with ios4

    Ever since i "upgraded" to the new ios4 software i can no longer listen to more than one song in a row without it stopping by itself. if im using apps while playing music it takes me back to the home screen. If someone knows how to fix this that would be nice bc im really frustrated with it and regret getting the software.

    But all of a sudden I cannot get my libraray or any playlist ti play more than one song at a time automatically. It just stops after each song.
    head into your itunes main library window. are all the little boxes to the left of your tracks unchecked?
    is so, hold down Ctrl and click on one of those boxes to recheck all the songs. (this may take a little time.)
    do you get continuous play once all the songs are rechecked?

  • How to apply data into 2 tables AND to more than one record in same table?

    Hello,
    I am trying to apply/insert data into 2 tables AND at the same time apply data to more than one record (in the same table). How would I do this in APEX?
    I have updated using one table with no problem, however, when I try updating with the two tables/ multiple record sets, I get errors.
    I appreciate the help.
    Thanks.
    Linda

    You can achieve what you want using PL/SQL. Can you post ur code?

  • RFC to XI File -  can NEVER EVER  get more than one record in Output file.

    Hi guys
    This might be related to my other post on  File conversion but whatever I do I just can't seem to get more than one record in the output file
    the payload from R3==> XI seems fine
    for example
    <?xml version="1.0" encoding="UTF-8" ?>
    - <rfc:Z_XI_005_RFC xmlns:rfc="urn:sap-com:document:sap:rfc:functions">
    - <IP_CUSTOMER_HEADER>
    - <item>
      <CUSTOMERID>1000001</CUSTOMERID>
      <COMPANY>One-time ship-to</COMPANY>
      <SHORT_NAME>ONE-TIME</SHORT_NAME>
      <STREET />
      <STREET2 />
      <STREET3 />
      <STREET4 />
    ...... more data
    </item>
    then next customer  master data and so on
    - <item>
      <CUSTOMERID>1000005</CUSTOMERID>
      <COMPANY>ddfask</COMPANY>
      <SHORT_NAME>;LK;L</SHORT_NAME>
      <STREET />
      <STREET2 />
      <STREET3 />
      <STREET4/>
    etc etc until
    <HKUNNR>60000</HKUNNR>
      <SALES_REGION />
      </item>
      </IP_CUSTOMER_HEADER>
      </rfc:Z_XI_005_RFC>  
    All I get on the Output target file
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ns1:MT_customer_header xmlns:ns1="http://avenue.com/xi/test">
      <CustomerId>1000001</CustomerId>
      <company>One-time ship-to</company>
      <shortname>ONE-TIME</shortname>
    .... more data
      </ns1:MT_customer_header>
    the <item> and subsequent records all seem to have vanished.
    I must be doing something PARTICULARLY stupid as nobody else ever seems to have this problem --  I've tried almost every possible combination but still to no avail
    The function module is passing a table to XI in the correct structure and the payload seems to be fine so what on earth is broken here !!!,.
    Cheers
    Jimbo

    Thanks everybody -- it's working now
    RFC call was passing data correctly
    function z_xi_005_rfc.
    ""Local interface:
    *"  TABLES
    *"      IP_CUSTOMER_HEADER STRUCTURE  ZAP_CUSTOMER_INFO_2
    endfunction.
    in debug mode table data was fine -- in this instance 3 records were being passed.
    3 errors  in mapping etc fixed (with help from SDN - thanks)
    1)  missing the ITEM level in the Data type (hence mapping)
    2)  needed 0:unbounded in the occurrence
    3)  also mapping Item====>Item was missing (sub fields were ok)
    Points awarded
    final file output ok output now  ok (with 3 fields only for testing)
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ns1:MT_customer_header xmlns:ns1="http://avenue.com/xi/test">
    - <item>
      <Customerid>1000001</Customerid>
      <company>One-time ship-to</company>
      <shortname>ONE-TIME</shortname>
      </item>
    - <item>
      <Customerid>1000005</Customerid>
      <company>ddfask</company>
      <shortname>;LK;L</shortname>
      </item>
    - <item>
      <Customerid>1000010</Customerid>
      <company>One Time Customer Test</company>
      <shortname>SADFIWQEFG</shortname>
      </item>
      </ns1:MT_customer_header>
    Now only the final problem to make file content conversion work.
    Once again thanks --sometimes what seem trivial or simple problems take AGES to fix until someone else gives you a clue --that's why boards like SDN are great value.
    Cheers
    Jimbo

  • How can i select more than one record in a LOV

    I want to select more than one record in a LOV and put them together before to display them in an item.

    This is not possible with a default LOV, so you'll need to create your own. There are a number of ways to select multiple records:
    a) you can use a tree and set Multi-Selection to Yes
    2) you can use a normal block with a checkbox on each row for the user to select records
    three) with the [SYSTEM.MOUSE_BUTTON_MODIFIERS|http://www.oracle.com/webapps/online-help/forms/10g/topics/designing_forms/mouse/at0604.html?tp=true] variable you can allow users to ctrl+click to select many records in a block. set the background colour to indicate a record has been selected
    iv) there is a pjc in the [demo code section|http://download.oracle.com/otndocs/demos/Forms_Demos_10gr2.zip] which lets you select many rows in a poplist

  • Can you have more than one account on a Mac for FaceTime?

    Several of us would like use FaceTime on the same Mac, can we set up more than one account on the Mac?

    Each user should have his or her own login account with its own files and settings, including FaceTime settings. There should be no problem.

  • More than one class in single java source file?

    Is there a way to define more than one class in single java source file?
    I get a duplicate class definition error for each extra class, but I am sure there is a way to handle this in JDeveloper.
    Anyone knows how ?

    Please post the question in jdeveloper forum at
    JDeveloper and ADF
    for quick response.
    Regards,
    Anupama
    http://otn.oracle.com/sample_code/content.html

  • In which IT To Date is not allowed & not having more than one record

    Hi all,
    Could you please tell me "In which IT To Date is not allowed & not having more than one record ?"
    Thanks in advance
    Regards,
    Asiya

    Hi,
    Just go through IT0003 and see if it fulfills the requirements or not.
    Param

Maybe you are looking for

  • Advanced mode in receiver FILE adapter

    Hi there, Does anyone of you have a list of aditional parameters to be specified in the receiver FTP communication channel? The only one i found is ftp.timeout and this is available on my default FTP connetion parameters. Thanks a lot in advance, Dav

  • HELP - setting page margins doesn`t work correctly

    Hi there, maybe someone encountered the same Problems I am facing. I am setting the page margins for the Left-Side to have enough space to punch the printout. Somehow CR seems to ignore the values I set when printing a Report. Most of the times I hav

  • How to use bonjour, in ichat or Imessages ???

    friends please help,if anyone know how to use Bonjour ?

  • How can I capture AVHDC video files from Panasonic HD video camera??

    I just received a Panasonic HS300 video camera and can't copy the video files on my computer. I see several files in the CAM_HDD camera folder on the desktop. But the only relevant files for me to copy are the JPG photos. I don't see any video files.

  • Download pictures not recognized in catalog

    I downloaded pictures from my camera into the folder where all of the other catalog pictures exist (by date 5/24) and they do not come up into the catalog (as May). After getting photos I get an error message that reads "The ODBC data source returned