selecting the top folder of each student

Hello

I have a table named the school where I have a list of students, the table looks like this.

score of the student to school
A 14 1 AB
A 7 2 AC
A 17 1 AA
B 1 2 BA
BB 4 2 B

I need the output as follows
score of the student to school
A 14 1 AB
B 1 2 BA

Regardless of the values of the student, mark and I need the first record of each school.

Something like that-

select school,
       student,
       score,
       in
from (
        select school,
               student,
               score,
               in,
               row_number() over(partition by school order by t_tmstmp) rn
        from t
     )
where rn = 1

N.B.: Not tested...

Kind regards.

LOULOU.

Tags: Database

Similar Questions

  • Workflow problem - how to stop Illustrator by selecting the top layer after each record?

    Hello

    One of the great things about diapers is the ability to have items in a locked layer above the layer you are using. However, when Illustrator finishes savings, he selects the layer and if the layer that is locked and then you travel constantly in the layers palette to select the layer that you worked prior to backup - I need to that 50 - 100 times per hour.

    Is there a way to force Illustrator to remember you were working before the backup - and bring him back to this layer after layer save him?

    Any pointers in the right direction would be much apprciated.

    See you soon

    Ben

    Yo know what - I think this may have something to do with having "Create a PDF compatible" off in la - like preferences.

    It seems that when this option is enabled, the problem does not occur, but turn it off makes it - I just tried this on a whole new file with text and boxes.

    It's the same for you guys?

  • I use a horizontal menu of the widgets library. All right, except that I would have any of the drop-down list list stay open after selecting the top item... and remain open after the selection of a menu under item - so that the viewer knows where they are

    I use a horizontal menu of the widgets library. All right, except that I wish I had the all menu drop-down list stay open when you have selected the top element. And when you have selected a menu SUP item - so that the viewer knows where they are in the navigation. Who is? Thank you!

    Hello

    There is no native function to Muse to achieve this goal. However, if you host your site on Business Catalyst, you can take advantage of the functionality of breadcrumbs. He won't let the open drop-down list stay, but it will show customers on what page they are and that he can see that they have followed to reach the page. For more information, please visit the following link http://helpx.adobe.com/business-catalyst/partner/add-breadcrumbs.html

    Kind regards

    Aish

  • How to find the rank lowest for each student using a Select query?

    Hey I'm having a little trouble here

    I have this table


    Student - Grade

    John - 8
    Richard - 9
    Louis - 9
    Francis - 5
    John - 13
    Richard - 10
    Peter - 12

    Shades may vary from 0 to 20.

    Name - varchar (50)
    Grade - wide

    I'm trying to generate a SQL search to search for each rank lowest for each student.

    So far, I did:

    Select s.name, s.grade
    s student
    where s.grade = (select min (grade) of student)

    The result of this search returns me only the rank lowest of all ranks posted above, which is Francis - 5.

    I want to find the lowest rank, but not only for Francis, but for all students in the table.

    How do I do that?

    Thank you in advance.

    Ok

    Now we head into analytical SQL:

    with student as (select 'John' name, 8 grade, 'fail' result from dual union all
                     select 'John' name, 13 grade, 'pass' result from dual union all
                     select 'Francis',     5 grade,  'fail' from dual union all
                     select 'Peter', 12, 'pass' from dual)
    -- End of your test data
    SELECT   name,
             MAX (result) KEEP (DENSE_RANK FIRST ORDER BY grade) result,
             MIN (grade) min_grade
    FROM     student
    GROUP BY name
    

    Please note that I passed ;)

    Concerning
    Peter

    To learn more:
    http://download.Oracle.com/docs/CD/B19306_01/server.102/b14200/functions056.htm#SQLRF00641

  • Remove duplicates by selecting the first line of each subgroup in a Recordset

    Oracle: 11 GR 2

    Client Windows 7

    I have a set of data (the result of a query) which is similar to:

    D_rank product_id product_desc category income price cost

    1 112233 prod1-iphone phone 200 500 100

    1 112233 prod1-iphone4 phone 200 500 100

    2 223344 prod2-300 1000 400 windows7 OS

    2 223344 prod2-300 1000 400 software windows7

    3 334455 prod3-Mac 1000 computer 1500-1000

    4 445566 prod4-xyz 2000 800 1200 misc

    :                    :               :                                   :               :             :              :

    :                    :               :                                   :               :             :              :

    :                    :               :                                   :               :             :              :

    As you can see the first 4 rows, these rows are repeated due to the product_desc and category material. I need these fields but the first value in each subgroup, so that each row is unique. I.e.

    D_rank product_id product_desc category income price cost

    1 112233 prod1-iphone phone 200 500 100

    2 223344 prod2-300 1000 400 windows7 OS

    3 334455 prod3-Mac 1000 computer 1500-1000

    4 445566 prod4-xyz 2000 800 1200 misc

    :                    :               :                                   :               :             :              :

    :                    :               :                                   :               :             :              :

    :                    :               :                                   :               :             :              :

    You will enjoy the little help.

    Hello

    user13667036 wrote:

    Oracle: 11 GR 2

    Client Windows 7

    I have a set of data (the result of a query) which is similar to:

    D_rank product_id product_desc category income price cost

    1 112233 prod1-iphone phone 200 500 100

    1 112233 prod1-iphone4 phone 200 500 100

    2 223344 prod2-300 1000 400 windows7 OS

    2 223344 prod2-300 1000 400 software windows7

    3 334455 prod3-Mac 1000 computer 1500-1000

    4 445566 prod4-xyz 2000 800 1200 misc

    :                    :               :                                   :               :             :              :

    :                    :               :                                   :               :             :              :

    :                    :               :                                   :               :             :              :

    As you can see the first 4 rows, these rows are repeated due to the product_desc and category material. I have need of these fields but the first value of each subgroup...

    ...

    What does "first" here?  What "subgroup"?

    Depending on your needs, maybe you want to Request Top - N, something like this:

    WITH got_r_num AS

    (

    SELECT d_rank, product_id, product_desc, category, price, income, cost

    ROW_NUMBER () OVER (PARTITION BY d_rank

    ORDER BY product_desc, category

    ) AS r_num

    OF data_set

    )

    SELECT d_rank, product_id, product_desc, category, price, income, cost

    OF got_r_num

    WHERE r_num = 1

    ;

    I hope that answers your question.

    If this isn't the case, please post a small example of data (CREATE TABLE and INSERT statements) and the results desired from these data.  (I know you said this is a game of results from a query, and not an array, but the solution is the same as the entry is a single table, or a query, perhaps involvoing several tables.)

    Report when the request above is erroneous results and explain, using specific examples, how find you the correct results from these data.

    As said ground, see the FAQ in the forum: Re: 2. How can I ask a question on the forums?

  • Select the top row of ADF Table default

    jdev 11.1.1. 6

    In my application, I have a fall towards the bass and based on the value, select from the drop-down list on the af: table is filled (using the drop-down list vcl property, I'm populating the VO based on which the table is).

    The table has "selectionListener" defined in a method at the bean so that every time a line is selected some operation.

    < af:table value = "#{bindings." RoleVO1.collectionModel}.

    var = "row" rows = "#{bindings." RoleVO1.rangeSize}"width ="500 ".

    "partialTriggers =": soc1: cb1: cb2.

    emptyText = "#{bindings." RoleVO1.viewable? "{'No data to display.': 'Access Denied.'}".

    fetchSize = "#{bindings." RoleVO1.rangeSize}.

    rowBandingInterval = '0 '.

    selectedRowKeys = ' #{bindings. " RoleVO1.collectionModel.selectedRow}.

    selectionListener = "#{CRoleARoleBean.roleTableSelection} '"

    rowSelection = "single" id = "t1".

    editingMode = "clickToEdit."

    Binding = "#{CRoleARoleBean.roleTable}" >

    I have here a certain way, I can make the top row of the selected table and trigger the selectionListener by programming the dropdown each time value is bud?

    Please notify

    by selecting the default line can be obtained by adding after the vcl in drop-down list:

    this.roleTable.setRowIndex (1);

    RowKeySet ch = this.roleTable.getSelectedRowKeys ();

    PS. Clear();

    PS. Add (this.roleTable.getRowKey ());

    AdfFacesContext.getCurrentInstance () .addPartialTarget (this.roleTable);

    Make sure the displayRow selected = is defined in the table property

  • By selecting the "new folder" button

    Hello.  My "new folder" button isn't more works-it does not create a folder named my documents or on my USB key.  Running Windows 7 on my laptop.  Tried right click and create a folder zipped, but which is not working too.  Computer of the year and the "new folder" button always worked normally until recently.  Cannot find patches by Microsoft.  Any help would be greatly appreciated. Thanx

    (1) run chkdsk as follows:

    A prompt by right clicking and select "Run as Administrator"
    and then at the command prompt, type: chkdsk /f r, then press the Enter key.

    If you are asked to plan the volume to check the next time that the system/PC reboots,
    Enter: y

    Now, restart the PC.

    If you know the manufacturing of your hard drive you can also download their diagnostic software.

    Another use: SpeedFan has an online health analysis function
    (SMART tab) for hard drives. It will show how your disks
    compared with other discs of the same brand and model.
    http://www.almico.com/SpeedFan.php
    Note: Unfortunately now includes a lot of bloat-ware, be very careful when installing remove bloat-ware.

    =====================================================================

    (2) run the command SFC /SCANNOW. This will check and repair if necessary all of the critical Windows system files.

    Click on start / all programs/accessories then
    Right-click on the command prompt option and select "Run as Administrator".
    (or "Safe Mode" open a command prompt)
    At the command prompt, enter: SFC/scannow

    Windows 7 - order SCANNOW SFC - System File Checker
    http://www.SevenForums.com/tutorials/1538-SFC-SCANNOW-Command-System-File-Checker.html

    How to use the System File Checker tool to fix the system files missing or corrupted on Windows Vista or Windows 7
    http://support.Microsoft.com/kb/929833

    How to analyze the entries in log file generating the program Checker (SFC.exe) resources of Microsoft Windows in Windows Vista:
    http://support.Microsoft.com/kb/928228

    =================================================================

    If SFC Scannow could not repair any or all the corrupt system files
    follow these steps:

    (a) open a command prompt (start / all programs / accessories)
    Right click on the command line option, then select: run as administrator

    (b) at the command prompt, enter: DISM.exe/online/Cleanup-Image /ScanHealth

    Press the ENTER"" key.

    (c) then enter: DISM.exe/online/Cleanup-Image /RestoreHealth

    Press the ENTER"" key.

    (d) now rerun the command SFC/SCANNOW...

    At the command prompt, enter: SFC/scannow

    J W Stuart: http://www.pagestart.com

  • Select the last record of each month

    Hello

    to select the last docnumber and qty of every month

    Structure

    Name Null?    Type

    ------------------------------- -------- ----

    PRODUCTCODE NUMBER

    NUMBER NUMBER

    DATE OF PLANFORMONTH

    NUMBER OF CLEXPECTEDQTY

    NUMBER OF CLCONFIRMQTY

    NUMBER OF CLFGBUFFERQTY

    NUMBER OF CLTOTPRINTBUFFER

    in this select query if I take the sum he required all records where, as I want the last record of each month

    SELECT productcode docnumber MAX (Number), planformonth, SUM (clexpectedqty) clexpectedqty (planformonth) MAX.

    SUM (clconfirmqty) clconfirmqty, SUM (clfgbufferqty) clfgbufferqty, cltotprintbuffer OF FGSALESPLAN of the SUM (cltotprintbuffer)

    GROUP BY productcode, (planformonth)

    Sandy

    Hello

    Thanks its working now the code is written as below:

    SELECT * FROM

    (SELECT

    e.*,

    ROW_NUMBER() OVER (partition by PRODUCTCODE by DOCNUMBER DESC order) r

    Of

    E FGSALESPLAN)

    WHERE r = 1 AND

    entryvalid = 'Y '.

    order by Number

    Sandy

  • by selecting the second result for each client...

    Hello

    I have a table that contains all the contacts that we have with our customers.
    We consider a file active file from the moment where there was 2 contacts for this customer.
    Today someone asked me "can you tell me how many new customers with an active file, we have this year."

    So what I really want to do now is make a view that contains the DATE of the SECOND CONTACT for each CLIENT_ID.

    the table looks like this:
    CONTACT_ID
    CLIENT_ID
    DATE
    CONTACT_FORM (any in this story)
    REMARKS (any in this story)

    Can someone help me with this please?

    Thanks in advance for your answers.

    L

    change I don't know how to make an opinion, which is not the problem :) in this case only the query select to make the problem there.

    Edit 2 I made a small example

    If I start with the data in this table:
    CLIENT_ID || DATE           .... other columns here...
    436     || 01-02-2011
    328     || 05-04-2011
    319     || 13-01-2011
    220     || 03-09-2011
    319     || 17-12-2011
    220     || 25-11-2011
    436     || 01-04-2011
    436     || 01-04-2011
    that vision must end up with:
    CLIENT_ID  || DATE_OF_SECOND_CONTACT
    436     || 01-04-2011
    220     || 25-11-2011
    319     || 17-12-2011
    (works with version 11.2.0.1.0)

    Published by: 901981 on 13-dec-2011 02:16

    If you do something like

    SELECT CLIENT_ID, date_column
    FROM (
    SELECT client_id, date_column, row_number() over (partition by client_id order by date_column asc) AS CONTACT
    FROM YOUR_TABLE)
    where contact = 2
    /
    

    HTH

    Roger

    Published by: Roger on December 13, 2011 02:19

  • Select the last value for each day of the table

    Hello!

    I have a table that contains several measures for each day. I need two queries on this table, and I'm not sure how to write them.

    The table stores the rows (sample data)
    *DateCol1                 Value       Database*
    27.09.2009 12:00:00       100           DB1
    27.09.2009 20:00:00       150           DB1
    27.09.2009 12:00:00       1000          DB2
    27.09.2009 20:00:00       1100          DB2
    28.09.2009 12:00:00       200           DB1
    28.09.2009 20:00:00       220           DB1
    28.09.2009 12:00:00       1500          DB2
    28.09.2009 20:00:00       2000          DB2
    Explanation of the data in the sample table:
    We measure the size of the data files belonging to each database to one or more times a day. The value column indicates the size of the files of database for each database at some point (date in DateCol1 European model).


    What I need:
    Query 1:
    The query must return to the last action for each day and the database. Like this:
    *DateCol1       Value      Database*
    27.09.2009        150          DB1
    27.09.2009       1100          DB2
    28.09.2009        220          DB1
    28.09.2009       2000          DB2
    Query 2:
    The query should return the average measurement for each day and the database. Like this:
    *DateCol1       Value      Database*
    27.09.2009       125          DB1
    27.09.2009      1050          DB2
    28.09.2009       210          DB1
    28.09.2009      1750          DB2
    Could someone please help me to write these two queries?

    Please let me know if you need further information.

    Published by: user7066552 on September 29, 2009 10:17

    Published by: user7066552 on September 29, 2009 10:17

    Why two queries when it suffice ;)

    SQL> select dt
      2       , db
      3       , val
      4       , avg_val
      5    from (
      6  select dt
      7       , val
      8       , db
      9       , row_number () over (partition by db, trunc (dt)
     10                                 order by dt desc
     11                            ) rn
     12       , avg (val) over (partition by db, trunc (dt)) avg_val
     13    from test)
     14   where rn = 1
     15  order by dt
     16  /
    
    DT        DB           VAL    AVG_VAL
    --------- ----- ---------- ----------
    27-SEP-09 DB2         1100       1050
    27-SEP-09 DB1          150        125
    28-SEP-09 DB2         2000       1750
    28-SEP-09 DB1          220        210
    
  • by automatically selecting the folder of origin for registration

    When I open a PDF from a folder and make changes, I want to CD to automatically select the location/folder of original file for recording. How do I do that? the earlier version of the drive used for this.

    Hi andrewf91748828,

    I understand your concern, but it is by default in a particular location, you will need to manually, navigate to the location you want to save the file.

    He also recalled frequently saved areas which can be directly selected to save the file.

    Kind regards

    Nicos

  • Do not remember the last folder that I exported the export

    I could swear that before I updated to Lightroom 2015.6 remind the last file I exported a file. I have now is having, navigate to the folder that I want and it's really annoying!

    My settings for this preset have no marked record because I always do not export this type of file in the same place. Does anyone know how can I fix?

    Screen Shot 2016-07-06 at 3.38.21 PM.png

    EDIT 3: FOUND!

    It is certainly a problem with the preset export settings. It turns out that, for some reason, Lr has launched a range with a 'destination of export' in all my Presets to export with the path to the folder that I mentioned in my first post. After erasing my old presets and creating a couple of new everything returned to normal, but as soon as I imported an old export preset and tried to use my "HD wallpapers" folder (Fondos HD in Spanish) would jump up on top of each export with this preset.

    So I opened and former export preset and another with "textedit" to see what was different and, of course, there was a line that should not be there...

    Note that on the former and before the 'export destination type = choose later' there is a "path of export destination prefix = /...» " line that is missing on the new preset, I created.

    FORMER Preset:

    NEW preset:

    I have not found a solution outside don't erase this line manually or simply redo all the presets, but at least I know how what is happening and how to fix it (unless Lr decides to mess with my presets again).

    I hope that helps!

    Original text: I have just connected to the report that I have the same 'problem' (Mac users)

    After renaming some of my exports now they all lead me to a folder named "HD Wallpapers" all the time (which is a file that I use to record the images that I would use as wallpaper and the export-only, I have a specific folder selected) before it always remember my last location, which has been really helpful. He randomly takes me to the location of the last well, but most of the time, it takes me to this folder "wallpaper".

    Edit: Rename this folder (Ex: "Wallpapers") worked but after overthrowing its original Lr name came back to her. I just tried it on my laptop (where I did no change) and I can confirm that my laptop Lr still remember my last file in the export location.

    Edit 2: When you choose 'Select the specific folder' there is a menu drop-down with the 'clear list' option, it does not work either. I tried to create a preset with the main folder of the Image in the specific folder and rename my folder "HD wallpapers" once again so he could at least lead me to this one. After doing this he started to work as before (remember my last location) but even once, as soon as I renamed the folder of my wallpapers to its original name, he began to take me back to it again each export. So I would say that there is something bad going on here.

  • Lightroom CC 2015.7 / Camera Raw 9.7 / macOS Sierra - could not find the Destination folder during import

    Hello world

    Sorry if this question is stupid, but I always imported files easily on my hard drive. But recently, since I've updated my Lightroom, I can't find the menu destination folder when importing photos.

    I go in the menu library, choose IMPORT, select the original folder, the photos I want to import and then, on the right side, I only see the option 'create an intelligent Preview' and the option of keywords/tags. Where is the part that I could choose the destination folder - and even create subfolders?

    If I click on the triangle in the lower left corner to minimize the menu, I can see the menu "create a subfolder. However, the normal display mode brings no option like that, but by selecting the main folder by clicking on the icon in the corner right-towards the top.

    What Miss me? It seems not very practical for me.

    Cheers in advance!

    The destination tab may have accidentally become hidden, next to one of the other header in the sidebar right and you click right there get a pop up that will allow you to restore it. See the screen capture.

  • Fewer steps to move has already imported pictures to the desktop folder in the LR catalog.

    I'm sure this has been asked and I just use a terminology inappropriate then forgive me.  I'm trying to get a group of imported pictures that currently link to a folder on the desktop in my LR catalog instead.

    I use a Mac.

    Thank you for your help.

    Dan

    Sure.  Yes, I imported the photos in lightroom, but they were not copied to the LR making catalog. I can not use the term 'catalogue' correctly. I am referring to the designated folder system where LR stores all of my original images.  I have used inadvertently the function 'Add' during their import?

    Photos imported into Lightroom are indeed in the Lightroom Catalog. There's no other way.

    If you used the option Add instead of the COPY option, you would have to do one of the following values (only one, not both of them or all three):

    1. Move photos to the desired inside Lightroom (select all the pictures, then drag them to the desired folder, everything is done entirely in Lightroom). OR
    2. Move the pictures in your operating system to the folder desired; Then, you will find that each photo in Lightroom has an exclamation point icon; Click on the exclamation point icon, and then select the new folder (see these instructions: How to find missing pictures in Photoshop Lightroom ). OR
    3. remove photos from Lightroom (this will remove also publishes, metadata, collections, etc.) and then import them using COPY

    I prefer option 2, but option 3 is actually easiest if you have not yet completed all the work on photos.

  • Moving the Outlook Express Store folder to the shared folder of VMWare

    I am running Windows XP under Fusion 5.0.2 on my iMac running OS 10.8.2.  I want to move Outlook Express folder my wife of storage in VMware's shared folder so that its records are included in backups Time Machine.  Unfortunately, as soon as I select the VMware folder in the navigation under Tools > Options > Maintenance > store folder, the OK button will gray preventing selection.

    I originally moved the storage folder of OE out of its usual location on the virtual C drive on an external disk to keep data staff internal hard drive in the iMac. I created a file of commands using XXCOPY for saving these files to another external hard drive, but it does not provide a backup of the version; that is, if inadvertently, I save a damaged file, I have two copies of the corrupted file and no good copy to return.  (Fortunately, I also do a weekly backup on another external drive that I keep off site, which saved me from disaster recently.)

    I exclude the virtual machine (.vmwarevm) all backups TM to go back to the storage of OE on the virtual C drive folder would not solve my problem.

    I decided that the usefulness of TM outweighs the risk of having some personal data on the internal hard drive and transferred all my other files in the share folder VMware, that works very well to keep my files, they are created in Windows or on the host, in a place and keeping them supported by TM.

    I guess not being not able to move the OE store folder to the shared folder of VMware is a limitation of Windows, but does anyone know a way around?

    It's doable, even if you manually change the "Store Root" key in the Windows registry to point to the network location while OE is closed.

    See the image below for example, although it is worth noting that the path between the {} will be different for each user.

    (Click on the image to enlarge).

Maybe you are looking for