Count the occurrences of the maximum values

Hello

I don't know if I simply not thinking clearly this morning or not, but I find it difficult to write a query which I believe should be simple enough.  I'm trying to find the number of occurrences of a maximum value for each value in a range.

Here's the situation:

I have a table that stores the scores on the Act and SAT tests for students, as well as their student number identification codes and test. The table can store notes reviews multiple with same code test (in this case A01) for each student, the student can take the Act or SAT several times.

In my case, I need to know the number of students who earned a maximum test between 14 and 25 grouped by test score.  So if I had 500 students, and 300 of them took the test ACT, then my output can resemble:

REVIEW NOTE number of STUDENTS

14                                   12

15                                   18

16                                   45

17                                   55

18                                   100

19                                   35

20                                   15

21                                   10

22                                   5

23                                   3

24                                   1

25                                   1

Although there may be 400 scores in tests with the test code (A01), I'm only willing to count the maximum score that the student has received.

Fields:

ID: sortest_pidm

Test code: sortest_tesc_code

Test score: sortest_test_score

I'm going to use this as part of a larger query to track the retention of students with different ACT and SAT scores.

Thanks for any help you can provide.  If anything is unclear, please feel free to ask for clarification.

Bob

It should work. Just check the table and column names.

SELECT max_sortest_test_score, COUNT (*)

FROM (SELECT sortest_pidm, MAX (sortest_test_score) max_sortest_test_score

OF test_scores

WHERE sortest_tesc_code = "A01".

GROUP BY sortest_pidm)

GROUP BY max_sortest_test_score

ORDER BY 1;

Tags: Database

Similar Questions

  • How to find the maximum value in a collection

    Hi all

    I'm using Oracle 11 g 2. I need to know the maximum value in a collection of items.

    When I run the following, I get the maximum number of collection as '5' but I need the max value itself which is 8, please help.


    DECLARE
    type v_number1 is table of number of directory indexes;

    v_number v_number1;

    IDX NUMBER.
    psrc_file VARCHAR2 (10): = '1,2,4,8,6';
    v_src_file_string_array v_number1;
    number of max_temp;

    BEGIN

    SELECT regexp_substr (psrc_file, "[^,] +', 1, level") coll
    LOOSE COLLECTION v_src_file_string_array
    FROM (SELECT psrc_file FROM dual)
    CONNECTION OF LEVEL < = length (regexp_replace (psrc_file, "[^,] +")) + 1;

    -Set up some test values:
    BECAUSE me IN v_src_file_string_array. FIRST... v_src_file_string_array. COUNTING LOOP
    -v_numbers (i): = v_src_file_string_array (i);
    v_number (i): = i;
    END LOOP;

    max_temp: = v_number (v_number.first);
    IDX: = v_number.first;

    -Display the contents of the table:
    While the idx is not null
    loop
    If (idx) v_number > = max_temp
    then
    max_temp: = v_number (idx);
    end if;

    IDX: = v_number.next (idx);
    end loop;

    dbms_output.put_line ('Max: ' | max_temp);
    end;
    /


    Thank you!

    Harinath Arasu says:
    Hi all

    I'm using Oracle 11 g 2. I need to know the maximum value in a collection of items.

    When I run the following, I get the maximum number of collection as '5' but I need the max value itself which is 8, please help.

    DECLARE
    type v_number1 is table of number of directory indexes;

    v_number v_number1;

    IDX NUMBER.
    psrc_file VARCHAR2 (10): = '1,2,4,8,6';
    v_src_file_string_array v_number1;
    number of max_temp;

    BEGIN

    SELECT regexp_substr (psrc_file, "[^,] +', 1, level") coll
    LOOSE COLLECTION v_src_file_string_array
    FROM (SELECT psrc_file FROM dual)
    CONNECT BY LEVEL<= length(regexp_replace(psrc_file,="" '[^,]+'))="" +="">

    -Set up some test values:
    BECAUSE me IN v_src_file_string_array. FIRST... v_src_file_string_array. COUNTING LOOP

    It should be-online 1... v_src_file_string_array. COUNTY

    -v_numbers (i): = v_src_file_string_array (i);
    v_number (i): = i;

    This should be-online v_numbers (i): = v_src_file_string_array (i);

    Can't do you all just...

    DECLARE
         type v_number1 is table of number index by binary_integer;
         v_number v_number1;
         idx NUMBER;
         psrc_file VARCHAR2(10) := '1,2,4,8,6';
         v_src_file_string_array v_number1;
         max_temp number;
    BEGIN
         SELECT regexp_substr(psrc_file, '[^,]+', 1, level) coll
         BULK COLLECT INTO v_src_file_string_array
         FROM (SELECT psrc_file FROM dual)
         CONNECT BY LEVEL <= length(regexp_replace(psrc_file, '[^,]+')) + 1;
    
         FOR i IN 1..v_src_file_string_array.COUNT LOOP
           if max_temp is null or
                    v_src_file_string_array(i) > max_temp then
                max_temp := v_src_file_string_array(i);
              end if;
         END LOOP;
         dbms_output.put_line ('Max: ' || max_temp);
    end;
    

    Or more simply...

    DECLARE
         type v_number1 is table of number index by binary_integer;
         v_number v_number1;
         idx NUMBER;
         psrc_file VARCHAR2(10) := '1,2,4,8,6';
         v_src_file_string_array v_number1;
         max_temp number;
    BEGIN
             SELECT to_number(regexp_substr(psrc_file, '[^,]+', 1, level))
          BULK COLLECT INTO v_src_file_string_array
             FROM (SELECT psrc_file FROM dual)
                  CONNECT BY LEVEL <= length(regexp_replace(psrc_file, '[^,]+')) + 1
             order by 1 desc;
         dbms_output.put_line ('Max: ' || v_src_file_string_array(1));
    end;
    

    Published by: JAC on April 3, 2013 18:56
    Unhandled exception...

  • Persistent for the subtraction of the background image collection (how to get the maximum value of each pixel in a series of images IMAQ)

    Hi all

    I have a system of LabVIEW which takes advantage IMAQ tools and features of the Vision Development Module.  A useful feature that I put in place is to be able to take a snapshot of the video stream and then subtract this single image among the subsequent images.

    What I want to do is to collect a series of images instead of one, and then create a unique image of these frameworks is just the maximum value of pixels in each pixel (a bit like a display persistent).

    It would probably be very easy to be implemented by converting the image to a table and then by doing math number on the table and then turning into an image, but I hope that someone here may know how to use the IMAQ/VDM tools to do this in a way more compact.

    Thank you very much

    MK

    How about using Max comparison IMAQ operation?

  • How to set the maximum value of the slide in run mode

    Hello

    I have a number of files to process, the files are going to be covered in the runtime. I want to use a slider that controls a single in the process at some point file. As the total number of files cannot be pre-be determined, I wonder how I can configure the maximum value of the slider when running (after I know how many files in the pool).

    Any help will be greatly appreciated.

    JACIE

    Right-click on the property and select change writing.  Now you can wire a constant to the property node.

  • What is the maximum value of the specification number?

    Hello

    What is the maximum value of the specification number? When I put the number "UPDATE SpecNumManager SET StartingBlockNumber = 99999999"

    I create a few specs, I encounter error showing below when I try to save them. is this a bug? my version is v6111, thanks

    Thank you

    Terry

    Sql command execution error ' insert into specSummary (pkid, ActiveSigDocGroupSequence, AmberSLA, CreatedDate, EffectiveDate, fkAffiliate, fkCountry, fkGlobalSuccessionSpec, fkOriginatingTemplate, fkPermissionTemplate, fkProcessTemplate, fkSpecBusinessUnit, fkTaxonomyNode, SpecStatusID, GlobalSuccessionState, InactiveDate, IsHidden, IssueNum, IsTemplate, langCreatedIn, LastEdit, OriginatorID, OriginatorNameHistorical, OrigLangID, RedSLA, securityAccessLevel, SpecID, SpecNum, SpecNumber, SpecType, replaces, theOriginator, WorkflowStartDate) values (' 20205484dea2 - 2 ca 6-41eb-9806 - cce52513e7d4 ', '0', '0', August 19, 2013 10:01:27 ', August 19, 2013 10:01:27 ', NULL, NULL, NULL, NULL, '6000d0acb239-b9c6 - 478-a - 8 c 99-4ec741d2a1a5', "57566dc3c46b-b2fe-4276-ae7f-f7f1c28a913f") , NULL, "2141e3469193 - 4A 05-4953-9ef4-8bc08c1b1fb8 ', '2090111 c 6416-6de4-4707-b498-48a18671ca27', '-1234567890', 12/31/9999 00:00:00 ', ' 0', N '001', '0', '0', August 19, 2013 10:01:45 ', ' 0', not admin, Prodika ', ' 0', '0', '0', '2147d635d721 - 2ca 2-411 c-beed-d1584f7498ff', N '100000002', ' 100000002-001 ', ' 2147', NULL, ' 20533b94710f-5396-4487-bdd5-08d21365eefa»(, 19 août 2013 10:01:45 ') '.

    Specification numbers are 7 digits long. I believe that by default, the starting number is 5000000.

  • How to choose the maximum value in a column of a table by using the cursor and iteration

    Hello everyone
    I have a table loan_detail
    and a column inside loan_amount
    now I want to take the values in this table with the cursor, then using iteration that I want to take a max value of him using this slider
    Here is my table
    LOAN_AMOUNT
    
    100
    200
    300
    400
    500
    5600
    700
    I could make using the concepts of single loop, but when I tried to do by using the slider I wasn't able to do.
    Concerning
    Prost

    You can get the maximum value for a particular column in SQL, PLSQL needn't; Always avoid PLSQL so you can do it in SQL. But always as an example:

    declare
    number of Temp: = 0;
    Start
    for news in some loan_amt of loan_detail
    loop
    If (temp
    end if;
    end loop;
    dbms_output.put_line (temp);
    end;

    Edited by: Mahanam January 5, 2011 03:11

  • Organize the maximum values of magnitude of several strain gages according to their location.

    "There are 32 gauges installed on a 53' (is) 636" span beam which are 20 ' apart. The first pledge is 26 "support. The attached vi gives the amplitudes of the peaks of each pledge individually by changing the columns and rows in the control. Now, these maximum values should be prepared according to the spacing of the beam and join these points with a spline curve.

    Open the vi, give the path of the attached excel sheet. Now, in the beginning cluster attribute column 3, 620 to line in the end cluster assign to column 4, 845 to line. Now, run the vi. Assign the columns start and end must be (3,4), (5,6), (7,8) and so forth, to get the maximum amplitudes of each extensometer.

    Vlaminck

    Greetings Vgrchada.

    You can independently change the column and the row of every beginning and end by a beam control based on the name. Look at the example that attached. I changed the star and end constants controls because they will be handled programmatically (so there is no need for human beings humans interact with them) always use for the line start and end values, because there is where all the data are. As for the columns, use the iteration of the loop counter For (with differences appropriate, while it starts where it should) another possibility is to build a table with all indexes and use the property auto-index of the loop For (this in the case where the columns are not side by side).

    I would like to know how it works. (I have not tested this code, but the principle should at least help you find your way)

    Kind regards.

  • Calculate the maximum value of the sub-table when creating using a structure of case and records the shift

    I have two 1 d arrays that contain cyclical information (a bit like a sine wave).  One that contains information about the position in degrees and another that contains the couple.  I would like to calculate the value of maximum torque whenever the station is within a certain range (for example, 30 to 80 degrees).  The beaches are repeated - that is why it is cyclical.   I use the function "in the range", a structure of the case and the shift records to build a new table with the values that are included in the beach I said - that was easy part (see attached VI).  I'm struggling with a way to calculate a maximum value for each sub-table formed when the values are 'in range '.   Your help is very appreciated.

    vt92 solution worked!  I agree that there should be a simpler solution, but your to works fine.  Thank you very much.

  • Determine the maximum value and the minimum value for each value in the 2D array

    Hello, I need help please. Sorry my English is not very good. I have table 2D in which each value describes a waveform, I needed a time interval to determine the minimum and maximum value of each element of the array.


  • Tile performance - I want to set the maximum value to 100%

    Hello

    I'm running a question on the slab of the Performance.   I'm hungry when I'm adding percentages and rolling up to a tile of unique performance.  If the point x: 11%, Y: point 19%, point 24% Z:... etc.  However, when I add all the elements together, sometimes I'll get 101% which, in our profession, the rule, not possible.    Is there a way to force the maximum allowed be 100%?  I would like a method to implement logic that says: when summarizes all the elements, if the value is greater than 100, make the value of 100.

    I know that this sometimes rounding errors on individual items, but it is acceptable.  I'm looking for a way change the tile of the performance instead.

    Thank you

    Figured it out.  For future reference, I added a case statement for the sum... If the sum ([the index]) > 100 then 100.  Otherwise, use the sum ([the index]) essentially, go to edit the formula in the criteria and change now.

  • Set the Maximum value before an element

    Dear all,

    I work in the HRMS R12.

    I have a requirement to process the loan.

    The process is

    Loan of XX (recurring) element which has as input values
    Amount of the loan
    Number of payments
    Start date of deduction
    (Loan) Date of payment

    The amount of the loan to value entry has a constraint as it can use only 50% of the total compensation has gotten up to now that too if he finishes at least 5 years of service with the company so on up to 90% if the service is higher or equal to 9 years.
    This I'm calculation in the fast formula on how much is the maximum that the employee may request.

    Can you suggest me options so that when the user enters the requested amount it should allow only until the amount eligible ttarrd.

    Your entries are highly appreciated.

    Thank you

    Published by: 874719 on January 15, 2013 10:20

    No problem of Giuseppe :)
    Yes SESSION_DATE is a DBI.

  • SQL: How to get the maximum value of loans

    I have to display cod_acct_no, amt_disbursed, bal_book in table LOAN_MAST and maximum version of table LOAN_SCHEDULE CTR_STAGE_NO amt_instal. in other words; amt_instal of the most ctr_stage_no of table LOAN_SCHEDULE to display with the other value of LOAN_MAST column.

    You could help me pls.

    Data from these two tables are provided below:

    Main table ready
    INSERT INTO loan_mast
    VALUES
    ('00057110000431  ',2000000,1010605.39)
    /
    INSERT INTO loan_mast
    VALUES
    ('00057110000291  ',3500000,1212038.57)
    /
    INSERT INTO loan_mast
    VALUES
    ('00057110000450  ',2000000,1179199.79)
    /
    INSERT INTO loan_mast
    VALUES
    ('00057010001457  ',2000000,1555836.32)
    /
    INSERT INTO loan_mast
    VALUES
    ('00057010001650  ',9500000,8060419.1)
    /
    INSERT INTO loan_mast
    VALUES
    ('00057110050065  ',2000000,1742388.45)
    /
    INSERT INTO loan_mast
    VALUES
    ('00057010001947  ',2000000,1933540.07)
    /
    INSERT INTO loan_mast
    VALUES
    ('00057110050213  ',2000000,1978588.06)
    /
    INSERT INTO loan_mast
    VALUES
    ('00037010001104  ',6175000,3241694.48)
    /
    INSERT INTO loan_mast
    VALUES
    ('00037010001766  ',12000000,11715781.01)
    /
    INSERT INTO loan_mast
    VALUES
    ('00037300050025  ',7500000,7472981.78)
    /
    INSERT INTO loan_mast
    VALUES
    ('00037210000694  ',6500000,6588648.16)
    /
    INSERT INTO loan_mast
    VALUES
    ('00017210000087  ',5000000,4105246.38)
    /
    INSERT INTO loan_mast
    VALUES
    ('00017210000129  ',5000000,3478303.49)
    /
    INSERT INTO loan_mast
    VALUES
    ('00017210000141  ',5000000,3685293.79)
    /
    INSERT INTO loan_mast
    VALUES
    ('00017210000246  ',5000000,4029883.61)
    /
    INSERT INTO loan_mast
    VALUES
    ('00017210000268  ',5000000,4499322.1)
    /
    INSERT INTO loan_mast
    VALUES
    ('00017210000322  ',5000000,4966885.32)
    /
    INSERT INTO loan_mast
    VALUES
    ('00017300050014  ',7000000,6625970.85)
    /
    INSERT INTO loan_mast
    VALUES
    ('00017300050036  ',5700000,5687617.61)
    /
    INSERT INTO loan_mast
    VALUES
    ('00017300050047  ',7500000,7527560)
    /
    INSERT INTO loan_mast
    VALUES
    ('00017240000050  ',4300000,4300000)
    /
    INSERT INTO loan_mast
    VALUES
    ('00017210000449  ',7000000,7000000)
    /
    INSERT INTO loan_mast
    VALUES
    ('03017180001733  ',500000,335164.83)
    /
    INSERT INTO loan_mast
    VALUES
    ('01117110050071  ',700000,625123.9)
    /
    INSERT INTO loan_mast
    VALUES
    ('01077300050011  ',1500000,1447149.08)
    /
    INSERT INTO loan_mast
    VALUES
    ('00927180002119  ',500000,441488.25)
    /
    INSERT INTO loan_mast
    VALUES
    ('01507150051043  ',700000,633340.47)
    /
    INSERT INTO loan_mast
    VALUES
    ('03317290050040  ',300000,273601.45)
    /
    INSERT INTO loan_mast
    VALUES
    ('01027150051360  ',200000,179240.42)
    /
    INSERT INTO loan_mast
    VALUES
    ('01067150052782  ',300000,270794.1)
    /
    INSERT INTO loan_mast
    VALUES
    ('01137110050082  ',2000000,1786359.87)
    /
    INSERT INTO loan_mast
    VALUES
    ('01107150050610  ',200000,191399.56)
    /
    INSERT INTO loan_mast
    VALUES
    ('01117150051071  ',300000,271560.17)
    /
    INSERT INTO loan_mast
    VALUES
    ('01017210001052  ',6800000,6609837.58)
    /
    INSERT INTO loan_mast
    VALUES
    ('01157010001078  ',450000,425069.61)
    /
    INSERT INTO loan_mast
    VALUES
    ('00017180001173  ',700000,484447.94)
    /
    INSERT INTO loan_mast
    VALUES
    ('09997120004696  ',93099,64369.52)
    /
    INSERT INTO loan_mast
    VALUES
    ('01067010001654  ',285000,255579.7)
    /
    INSERT INTO loan_mast
    VALUES
    ('01017210001063  ',7000000,6930746)
    /
    INSERT INTO loan_mast
    VALUES
    ('01017210001105  ',7000000,6934246)
    /
    INSERT INTO loan_mast
    VALUES
    ('01017210001138  ',7000000,7000000)
    /
    INSERT INTO loan_mast
    VALUES
    ('01017210001116  ',7000000,7000000)
    /
    INSERT INTO loan_mast
    VALUES
    ('01017210001161  ',7000000,7000000)
    /
    INSERT INTO loan_mast
    VALUES
    ('01017210001150  ',7000000,7000000)
    /
    INSERT INTO loan_mast
    VALUES
    ('01017210001127  ',7000000,6930746)
    /
    INSERT INTO loan_mast
    VALUES
    ('00067110050043  ',700000,602416.77)
    /
    INSERT INTO loan_mast
    VALUES
    ('01147150052362  ',200000,178682.78)
    /
    INSERT INTO loan_mast
    VALUES
    ('01167150051647  ',75000,60057.01)
    /
    INSERT INTO loan_mast
    VALUES
    ('01017150053252  ',150000,125205.66)
    /
    INSERT INTO loan_mast
    VALUES
    ('00917150050232  ',100000,91972.04)
    /
    INSERT INTO loan_mast
    VALUES
    ('01017180003081  ',990000,663015.26)
    /
    INSERT INTO loan_mast
    VALUES
    ('09997220000893  ',154160,138665.08)
    /
    INSERT INTO loan_mast
    VALUES
    ('01017210000955  ',5000000,4510523.32)
    /
    INSERT INTO loan_mast
    VALUES
    ('00087150001049  ',1000000,904601.41)
    /
    INSERT INTO loan_mast
    VALUES
    ('01107010000288  ',300000,268703.55)
    /
    INSERT INTO loan_mast
    VALUES
    ('00087150001038  ',1000000,906085.9)
    /
    INSERT INTO loan_mast
    VALUES
    ('01107010000277  ',200000,184905.75)
    /
    INSERT INTO loan_mast
    VALUES
    ('00017080050030  ',500000,450047.42)
    /
    INSERT INTO loan_mast
    VALUES
    ('00037210000533  ',4000000,3346908.17)
    /
    INSERT INTO loan_mast
    VALUES
    ('01117180000631  ',990000,712874.67)
    /
    INSERT INTO loan_mast
    VALUES
    ('02007180001216  ',990000,792437.11)
    /
    INSERT INTO loan_mast
    VALUES
    ('01957180000928  ',400000,320317.9)
    /
    INSERT INTO loan_mast
    VALUES
    ('00037210000544  ',600000,518404.4)
    /
    INSERT INTO loan_mast
    VALUES
    ('01117110050060  ',1000000,893034.07)
    /
    INSERT INTO loan_mast
    VALUES
    ('00037180001877  ',800000,640405)
    /
    INSERT INTO loan_mast
    VALUES
    ('01047150052651  ',320000,288850.72)
    /
    INSERT INTO loan_mast
    VALUES
    ('01027160050103  ',100000,79915.86)
    /
    INSERT INTO loan_mast
    VALUES
    ('01067150052759  ',150000,129601.15)
    /
    INSERT INTO loan_mast
    VALUES
    ('01057150051287  ',800000,723681.12)
    /
    INSERT INTO loan_mast
    VALUES
    ('03317290050021  ',400000,359312.25)
    /
    INSERT INTO loan_mast
    VALUES
    ('01157150051316  ',500000,452300.73)
    /
    INSERT INTO loan_mast
    VALUES
    ('00037150050598  ',700000,633221.03)
    /
    INSERT INTO loan_mast
    VALUES
    ('01047150052673  ',150000,129610.95)
    /
    INSERT INTO loan_mast
    VALUES
    ('01147150052384  ',400000,361840.54)
    /
    INSERT INTO loan_mast
    VALUES
    ('01067150052802  ',150000,130840.94)
    /
    INSERT INTO loan_mast
    VALUES
    ('01157150051338  ',300000,259202.22)
    /
    INSERT INTO loan_mast
    VALUES
    ('01057150051307  ',400000,361840.54)
    /
    INSERT INTO loan_mast
    VALUES
    ('00017110050160  ',500000,397640.38)
    /
    INSERT INTO loan_mast
    VALUES
    ('01077150050910  ',100000,79915.86)
    /
    INSERT INTO loan_mast
    VALUES
    ('00057150050702  ',400000,360841.83)
    /
    INSERT INTO loan_mast
    VALUES
    ('01017150053271  ',150000,119955.86)
    /
    INSERT INTO loan_mast
    VALUES
    ('01057150051329  ',400000,360029.85)
    /
    INSERT INTO loan_mast
    VALUES
    ('01067150002665  ',500000,452300.73)
    /
    INSERT INTO loan_mast
    VALUES
    ('01077150050921  ',250000,225526.17)
    /
    INSERT INTO loan_mast
    VALUES
    ('00047150050693  ',200000,160494.64)
    /
    INSERT INTO loan_mast
    VALUES
    ('01077080050026  ',100000,91150.55)
    /
    INSERT INTO loan_mast
    VALUES
    ('01017150053293  ',150000,129675.2)
    /
    INSERT INTO loan_mast
    VALUES
    ('09997040001950  ',2500000,2439161.01)
    /
    INSERT INTO loan_mast
    VALUES
    ('09997120004685  ',75000,51855.74)
    /
    Table of loan from schedule+:
    INSERT INTO loan_schedule
    VALUES
    ('00017080050030  ',1,12426.29)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00017110050160  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00017110050160  ',2,17702.2)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00017180001173  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00017180001173  ',2,35116.22)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00037150050598  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00037150050598  ',2,18158.39)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00037180001877  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00037180001877  ',2,29122.98)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00037210000533  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00037210000533  ',2,144609.59)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00037210000544  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00037210000544  ',2,17625)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00047150050693  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00047150050693  ',2,7331.21)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00057150050702  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00057150050702  ',2,10157.38)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00067110050043  ',1,20017.91)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00087150001038  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00087150001038  ',2,25940.56)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00087150001049  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00087150001049  ',2,25940.56)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00917150050232  ',1,2937.5)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00927180002119  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00927180002119  ',2,25083.02)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01017150053252  ',1,5422.86)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01017150053271  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01017150053271  ',2,5422.86)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01017150053293  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01017150053293  ',2,4406.25)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01017180003081  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01017180003081  ',2,49664.37)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01017210000955  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01017210000955  ',2,126967.14)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01027150051360  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01027150051360  ',2,5980.03)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01027160050103  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01027160050103  ',2,3615.24)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01047150052651  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01047150052651  ',2,8125.9)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01047150052673  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01047150052673  ',2,4406.25)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01057150051287  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01057150051287  ',2,20752.45)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01057150051307  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01057150051307  ',2,10376.23)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01057150051329  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01057150051329  ',2,11960.05)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01067010001654  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01067010001654  ',2,6855.16)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01067150002665  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01067150002665  ',2,12970.28)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01067150052759  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01067150052759  ',2,4406.25)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01067150052782  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01067150052782  ',2,7618.03)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01067150052802  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01067150052802  ',2,5422.86)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01077080050026  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01077080050026  ',2,2485.26)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01077150050910  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01077150050910  ',2,3615.24)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01077150050921  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01077150050921  ',2,6348.36)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01077300050011  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01077300050011  ',2,23289.97)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01107010000277  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01107010000277  ',2,4550.62)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01107010000288  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01107010000288  ',2,7215.96)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01107150050610  ',1,5188.12)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01117110050060  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01117110050060  ',2,23528.29)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01117110050071  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01117110050071  ',2,16469.8)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01117150051071  ',1,7782.17)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01117180000631  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01117180000631  ',2,49664.37)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01137110050082  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01137110050082  ',2,47056.57)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01147150052362  ',1,5875)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01147150052384  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01147150052384  ',2,10376.23)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01157010001078  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01157010001078  ',2,10764.62)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01157150051316  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01157150051316  ',2,12970.28)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01157150051338  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01157150051338  ',2,8812.5)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01167150051647  ',1,2711.43)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01507150051043  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01507150051043  ',2,18158.39)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01957180000928  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01957180000928  ',2,14561.49)
    /
    INSERT INTO loan_schedule
    VALUES
    ('02007180001216  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('02007180001216  ',2,36039.68)
    /
    INSERT INTO loan_schedule
    VALUES
    ('03017180001733  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('03017180001733  ',2,25083.02)
    /
    INSERT INTO loan_schedule
    VALUES
    ('03317290050021  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('03317290050021  ',2,9833.81)
    /
    INSERT INTO loan_schedule
    VALUES
    ('03317290050040  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('03317290050040  ',2,7375.36)
    /
    INSERT INTO loan_schedule
    VALUES
    ('09997040001950  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('09997040001950  ',2,13864.94)
    /
    INSERT INTO loan_schedule
    VALUES
    ('09997120004685  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('09997120004685  ',2,3495.59)
    /
    INSERT INTO loan_schedule
    VALUES
    ('09997120004696  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('09997120004696  ',2,4339.15)
    /
    INSERT INTO loan_schedule
    VALUES
    ('09997220000893  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('09997220000893  ',2,3429.21)
    /
    Kind regards

    Yamen

    Hello

    When there is a WHERE clause, it always comes after the FROM clause. (Joints and their conditions are part of the FROM clause).
    Try this:

    WITH     got_rnum    AS
    (
         SELECT     cod_acct_no
         ,     amt_instal
         ,     ROW_NUMBER () OVER ( PARTITION BY  cod_acct_no
                                   ORDER BY          ctr_stage_no       DESC
                           ) AS rnum
         FROM    loan_schedule
    )
    SELECT     m.cod_acct_no, m.amt_disbursed, m.bal_book
    ,     r.amt_instal             AS high_amt_instal
    FROM     loan_mast     m
    JOIN     got_rnum     r     ON     r.cod_acct_no     = m.cod_acct_no
                        AND     r.rnum          = 1
    WHERE   m.cod_acct_stat = '8' ----------[this is condition is newly added to apply the same in production to fetch desired record]
    ;
    
  • get the value of the maximum value of a column for a particular type

    Hello.
    I have a query which returns the output something like

    Type of VersionNo ID ProductID VersionID category unusual
    1130 16650 16650 1193 5 Category1
    1130 16650 16650 1205 5 Category2
    1130 16650 16650 1242 5 category3
    1130 16650 1130 1001 1 Category1
    1130 16650 1130 1081 1 category3
    1131 16656 16656 1193 4 Category1
    1131 16656 16656 1205 4 Category2
    1131 16656 16656 1240 4 category3
    1131 16656 1131 1001 1 Category1
    1131 16656 1131 1081 1 category3

    I want to see the result that all the VersionId for the same ID values should have the same value for the category and it should be the value that is there for the maximum versionNo for a particular Type of «» Something like


    Type of VersionNo ID ProductID VersionID category unusual
    1130 16650 16650 1193 5 Category1
    1130 16650 16650 1205 5 Category2
    1130 16650 16650 1242 5 category3
    1130 16650 1130 1193 1 Category1
    1130 16650 16650 1205 1 Category2
    1130 16650 1130 1242 1 category3
    1131 16656 16656 1193 4 Category1
    1131 16656 16656 1205 4 Category2
    1131 16656 16656 1240 4 category3
    1131 16656 1131 1193 1 Category1
    1131 16656 16656 1205 1 Category2
    1131 16656 1131 1240 1 category3

    Does anyone know how to do this?

    Ok
    Try:

    WITH test_data AS (
    SELECT 1130 RecID, 16650 ProductID,  16650 VersionID, 1193  Category,  5 VersionNo, 'Category1' Type FROM DUAL UNION ALL
    SELECT 1130, 16650, 16650, 1205, 5, 'Category2' FROM DUAL UNION ALL
    SELECT 1130, 16650, 16650, 1242, 5, 'Category3' FROM DUAL UNION ALL
    SELECT 1130, 16650, 1130, 1193, 1, 'Category1' FROM DUAL UNION ALL
    SELECT 1130, 16650, 1130, 1205, 1, 'Category2' FROM DUAL UNION ALL
    SELECT 1130, 16650, 1130, 1242, 1, 'Category3' FROM DUAL),
    -- end test data
    max_data AS (
    SELECT RecID, ProductID, VersionID, Category, VersionNO, Type
      FROM test_data td1
     WHERE VersionNo = (
      SELECT MAX(VersionNo)
        FROM test_data td2
      WHERE td1.RecID = td2.RecID
         AND td1.ProductId = td2.ProductID))
    SELECT RecID, ProductID, VersionID, Category, VersionNO, Type
      FROM max_data
      UNION
    SELECT md1.RecID, md1.ProductID, td1.VersionID, md1.Category, td1.VersionNO, md1.Type
      FROM max_data md1
      JOIN test_data td1
     ON (md1.RecID = td1.RecID AND md1.ProductID = td1.ProductID)
    ORDER BY 1,2,3,5, 6
    
         RECID  PRODUCTID  VERSIONID   CATEGORY  VERSIONNO TYPE
    ---------- ---------- ---------- ---------- ---------- ---------
          1130      16650       1130       1193          1 Category1
          1130      16650       1130       1205          1 Category2
          1130      16650       1130       1242          1 Category3
          1130      16650      16650       1193          5 Category1
          1130      16650      16650       1205          5 Category2
          1130      16650      16650       1242          5 Category3
    

    And you simply:

    WITH max_data AS (
    SELECT RecID, ProductID, VersionID, Category, VersionNO, Type
      FROM test_data td1
     WHERE VersionNo = (
      SELECT MAX(VersionNo)
        FROM test_data td2
      WHERE td1.RecID = td2.RecID
         AND td1.ProductId = td2.ProductID))
    SELECT RecID, ProductID, VersionID, Category, VersionNO, Type
      FROM max_data
      UNION
    SELECT md1.RecID, md1.ProductID, td1.VersionID, md1.Category, td1.VersionNO, md1.Type
      FROM max_data md1
      JOIN test_data td1
     ON (md1.RecID = td1.RecID AND md1.ProductID = td1.ProductID)
    ORDER BY 1,2,3,5, 6
    
  • What is the maximum value supported SD card speed, class

    Hello

    I would like to know what the maximum taken in charge SD card support is class for a slot for SD cRIO-9031.

    I need to enter a SDHC card to be purchased for use in this system. I need "Industrial" SD cards and the speed indication changes the price considerably. (Class 4 vs. Class10 UHS-1 the two 8 GB, the latter is 4 x times the price of the first appr.) EUR200)

    Please provide me with the material specifications of the cRIO-9031 SD card slot (manual specification of '376261-02' States: ' removable SD (user-provided) up to 32 GB ")

    Hi André,.

    CompactRIO-9031 supports the SD write speed of up to 10 MB/s and supports the standard SDHC cards. As a result, SDHC Class 10 cards speed must be supported. Please see page 4 of the manual from the link below:

    http://www.NI.com/PDF/manuals/376261a_02.PDF

    However, there are many factors that can influence the observed flow rate as the compressibility of the data, write speed loop, write size etc. Please be aware of these factors when programming.

    Thank you

    Tom

    NIUK

  • count the pixel values in an array

    Hello

    I converted my image into a 2D array, then I use the array subset function to return the subarray of my columns in 1023.

    Now I want Rich Textlike to analyze my image vertically in a column to add the pixel values in each column and return the result for each column. So I would like to extract the indexof the minimum value, which is what I'm looking for.

    I have an idea please let me know.

    enclosed please find my vi

    Thank you

    Looks like you are doing things the hard way.  Instead, I suggest using IMAQ LinearAverages rather at the entrance of the rectangle in option.  This will give you the average of each column, which is just the total divided by the number of pixels.  You can then use the Min search the index of the smallest value table.

    Bruce

Maybe you are looking for