find previous record

CREATE TABLE F_TIME

(

NUMBER OF PERIOD_ID,

PERIOD_NAME VARCHAR2 (30 CHAR),

NUMBER OF PERIOD_YEAR,

PERIOD_TYPE VARCHAR2 (30 CHAR),

CREATION_DATE DATE,

UPDATE_DATE DATE,

NUMBER OF UPDATE_BY

);

TOGETHER TO DEFINE

Insert into F_TIME

(PERIOD_ID, PERIOD_NAME, PERIOD_TYPE, PERIOD_YEAR, CREATION_DATE,

UPDATE_DATE)

Values

(16, "T4", 2012, 'q', TO_DATE (April 20, 2013 17:41:28 ',' DD/MM/YYYY HH24:MI:SS'),)

TO_DATE('04/20/2013 17:41:28', 'MM/DD/YYYY HH24:MI:SS'));)

Insert into F_TIME

(PERIOD_ID, PERIOD_NAME, PERIOD_TYPE, PERIOD_YEAR, CREATION_DATE,

UPDATE_DATE)

Values

(17, '2012', 2012, 'y', TO_DATE (April 20, 2013 17:41:28 ',' DD/MM/YYYY HH24:MI:SS'),)

TO_DATE('04/20/2013 17:41:28', 'MM/DD/YYYY HH24:MI:SS'));)

Insert into F_TIME

(PERIOD_ID, PERIOD_NAME, PERIOD_TYPE, PERIOD_YEAR, CREATION_DATE,

UPDATE_DATE)

Values

(18, "Jan", 2013, ', TO_DATE (April 20, 2013 17:41:27 ',' DD/MM/YYYY HH24:MI:SS'),)

TO_DATE('04/20/2013 17:41:27', 'MM/DD/YYYY HH24:MI:SS'));)

Insert into F_TIME

(PERIOD_ID, PERIOD_NAME, PERIOD_TYPE, PERIOD_YEAR, CREATION_DATE,

UPDATE_DATE)

Values

(19, 'February', 2013, ', TO_DATE (April 20, 2013 17:41:27 ',' DD/MM/YYYY HH24:MI:SS'),)

TO_DATE('04/20/2013 17:41:27', 'MM/DD/YYYY HH24:MI:SS'));)

Insert into F_TIME

(PERIOD_ID, PERIOD_NAME, PERIOD_TYPE, PERIOD_YEAR, CREATION_DATE,

UPDATE_DATE)

Values

(20, "Mar", 2013, ', TO_DATE (April 20, 2013 17:41:27 ',' DD/MM/YYYY HH24:MI:SS'),)

TO_DATE('04/20/2013 17:41:27', 'MM/DD/YYYY HH24:MI:SS'));)

Insert into F_TIME

(PERIOD_ID, PERIOD_NAME, PERIOD_TYPE, PERIOD_YEAR, CREATION_DATE,

UPDATE_DATE)

Values

(21, 'April', 2013, ', TO_DATE (April 20, 2013 17:41:27 ',' DD/MM/YYYY HH24:MI:SS'),)

TO_DATE('04/20/2013 17:41:27', 'MM/DD/YYYY HH24:MI:SS'));)

Insert into F_TIME

(PERIOD_ID, PERIOD_NAME, PERIOD_TYPE, PERIOD_YEAR, CREATION_DATE,

UPDATE_DATE)

Values

(22, 'May', 2013, ', TO_DATE (April 20, 2013 17:41:27 ',' DD/MM/YYYY HH24:MI:SS'),)

TO_DATE('04/20/2013 17:41:27', 'MM/DD/YYYY HH24:MI:SS'));)

Insert into F_TIME

(PERIOD_ID, PERIOD_NAME, PERIOD_TYPE, PERIOD_YEAR, CREATION_DATE,

UPDATE_DATE)

Values

(23, 'June', 2013, ', TO_DATE (April 20, 2013 17:41:27 ',' DD/MM/YYYY HH24:MI:SS'),)

TO_DATE('04/20/2013 17:41:27', 'MM/DD/YYYY HH24:MI:SS'));)

Insert into F_TIME

(PERIOD_ID, PERIOD_NAME, PERIOD_TYPE, PERIOD_YEAR, CREATION_DATE,

UPDATE_DATE)

Values

(24, "July", 2013, am', TO_DATE (April 20, 2013 17:41:27 ',' DD/MM/YYYY HH24:MI:SS'),)

TO_DATE('04/20/2013 17:41:27', 'MM/DD/YYYY HH24:MI:SS'));)

Insert into F_TIME

(PERIOD_ID, PERIOD_NAME, PERIOD_TYPE, PERIOD_YEAR, CREATION_DATE,

UPDATE_DATE)

Values

(25, "August", 2013, ', TO_DATE (April 20, 2013 17:41:27 ',' DD/MM/YYYY HH24:MI:SS'),)

TO_DATE('04/20/2013 17:41:27', 'MM/DD/YYYY HH24:MI:SS'));)

Insert into F_TIME

(PERIOD_ID, PERIOD_NAME, PERIOD_TYPE, PERIOD_YEAR, CREATION_DATE,

UPDATE_DATE)

Values

(26, "MS", 2013, ', TO_DATE (April 20, 2013 17:41:28 ',' DD/MM/YYYY HH24:MI:SS'),)

TO_DATE('04/20/2013 17:41:28', 'MM/DD/YYYY HH24:MI:SS'));)

Insert into F_TIME

(PERIOD_ID, PERIOD_NAME, PERIOD_TYPE, PERIOD_YEAR, CREATION_DATE,

UPDATE_DATE)

Values

(27, "October", 2013, am', TO_DATE (April 20, 2013 17:41:28 ',' DD/MM/YYYY HH24:MI:SS'),)

TO_DATE('04/20/2013 17:41:28', 'MM/DD/YYYY HH24:MI:SS'));)

Insert into F_TIME

(PERIOD_ID, PERIOD_NAME, PERIOD_TYPE, PERIOD_YEAR, CREATION_DATE,

UPDATE_DATE)

Values

(28, "November", 2013, ', TO_DATE (April 20, 2013 17:41:28 ',' DD/MM/YYYY HH24:MI:SS'),)

TO_DATE('04/20/2013 17:41:28', 'MM/DD/YYYY HH24:MI:SS'));)

Insert into F_TIME

(PERIOD_ID, PERIOD_NAME, PERIOD_TYPE, PERIOD_YEAR, CREATION_DATE,

UPDATE_DATE)

Values

(29, 'Dec', 2013, ', TO_DATE (April 20, 2013 17:41:28 ',' DD/MM/YYYY HH24:MI:SS'),)

TO_DATE('04/20/2013 17:41:28', 'MM/DD/YYYY HH24:MI:SS'));)

Insert into F_TIME

(PERIOD_ID, PERIOD_NAME, PERIOD_TYPE, PERIOD_YEAR, CREATION_DATE,

UPDATE_DATE)

Values

(30, "Q1", 2013, 'q', TO_DATE (April 20, 2013 17:41:28 ',' DD/MM/YYYY HH24:MI:SS'),)

TO_DATE('04/20/2013 17:41:28', 'MM/DD/YYYY HH24:MI:SS'));)

COMMIT;

Select *.

of F_TIME

where period_type = 'q '.

- and period_id = 30

order by 1

If I spend 30, then it will return period id = 16 data

Or perhaps better:

SQL > SELECT *.

2 from f_time a

3. WHERE period_id = (SELECT max (b.period_id) OF f_time b WHERE b.period_id)< 30="" and="" period_type='q'>

4.

PERIOD_ID PERIOD_YEAR PERIOD_TYPE CREATION UPDATE_D UPDATE_BY PERIOD_NAME

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

16 q Q4 2012 20.04.13 20.04.13

Tags: Database

Similar Questions

  • I can't find the recorded files recently in my document folder

    I can't find the recorded files recently in my document folder

    Maybe not save them there.

    Assuming that you have saved the today, go to the Finder, type 'Today' in the oval at top right.

  • Time machine can not read my previous record

    I have reinstalled mac system and erase hard drive 3 weeks ago, but I didn't completely copy all of the files of music, so when I use time machine to restore it save only sometime after I reinstalled my mac.

    I wonder how I will get my previous record? What is the problem of the authority, if time machine won't let me read the previous record?

    someone knows how to fix this?

    Should have immediately restored the files... It will now make a mess.

    I assume that all the music files means your iTunes library... If not, what do you mean?

    Did you use the same name for Mac as it did on the old installation?

    You did backup on top of the existing backup or did you start a new backup.

    If you started a new backup, you can migrate files... open the utility Directory migration wizard and select the previous backup...

    However, there are questions if you used the same user name that you currently have... Tell me if you use the same computer name or the same username.

  • I find these records long name with 20 or more charactors and inside them is nothing else than "mrt.exe" file. I find them in random places.

    Original title: MRT. EXE files are all over my computer.

    I find these records long name with 20 or more charactors and inside them is nothing else than "mrt.exe" file. I find them in random places on my drive c: and many of them on my external G drive in the root. A new appears approximately every three months.

    I know the mrt.exe is supposed to have something to do with the malicious software removal tool, so I don't want to just delete them and have a problem.

    Allen

    Hello

    Are you prevents the tool from running?

    See Q21 at the end of this article

    The Microsoft Windows malicious software removal tool helps remove specific and prevalent malicious
    software for computers running Windows 7, Windows Vista, Windows Server 2003, Windows
    Server 2008, or Windows XP
    http://support.Microsoft.com/kb/890830

    What you do not know the Windows Malicious Software Removal Tool
    http://blogs.Computerworld.com/what_you_dont_know_about_the_windows_malicious_software_removal_tool

    What is Windows Malicious Software Removal Tool (mrt.exe) and how to use it
    http://www.vista4beginners.com/Windows-malicious-software-removal-tool?page=1

    I hope this helps.

    Rob Brown - MS MVP - Windows Desktop Experience: Bike - Mark Twain said it right.

  • A document I had previously recorded on my flash drive. All of a sudden the paragraph symbol appeared at the beginning of each line in the document and in documents on flash drive

    Original title: Word 2003 Documents

    I was working on a document I had previously recorded on my flash drive.  All of a sudden the paragraph symbol appeared at the beginning of each line in the document and all documents on the flash drive.  In addition, it appears on every document in the my documents folder.

    Can anyone help?

    Google search:

    How do I turn off paragraph symbol in Word 2003

    "You should have a paragraph symbol button in the bar... click on this tool and formatting symbols will disappear."

  • Error on push notifications "cannot find any record of application settings.

    Hi im getting the error "Unable to find any record of application settings", with status 0 code. I hope someone can help me.

    private function addNotificationToHub():void
    {
    NotificationManager.notificationManager.addEventListener(ErrorEvent.ERROR, onNotificationError);
    NotificationManager.notificationManager.notifyNotification(notification);
    }
    
    private function onNotificationError(event:ErrorEvent):void
    {
    trace(event.errorID);
    }
    

    Thank you

    Javier

    I got it to notify the notification with the NotificationManager.notificationManager.notifyNotification () method, we need to display notification post_notification permission on bar - descriptor.xml authorisation to work.

    I found this error in google or here perhaps because almost everyone followed the tutorial on message notification.

    He also worked for me before, but the descriptorfile has been changed for some reason any and I do not notice it.

  • Find no records in an Excel sheet

    Hi all

    I am importing data from an excel file into oracle database. I wanted to know the number of records in an excel file and no columns using oracle webutil (Client_ole2). I received a web code that works very well, adding a NEM statement at the end of the file each time. Maybe it's not practical always, cannot ask user each time to add a statement of NEM, which in turn result in program to run infinitely.

    This is the code that is running

    DECLARE

    application Client_OLE2. Obj_Type;

    Client_OLE2 workbooks. Obj_Type;

    workbook Client_OLE2. Obj_Type;

    Client_OLE2 spreadsheets. Obj_Type;

    worksheet Client_OLE2. Obj_Type;

    worksheet2 Client_OLE2. Obj_Type;

    cell Client_OLE2. OBJ_TYPE;

    Client_OLE2 args. OBJ_TYPE;

    cell_value varchar2 (100);

    num_wrkshts NUMBER;

    wksht_name VARCHAR2 (250);

    EOD Boolean: = false;

    j integer: = 3;

    v_fName VARCHAR2 (250);

    worksheet_count number: = 0;

    BEGIN

    -Get the name of the file to open

    -v_fName: = "D:\MyDevelopment\Forms\Samples\WebUtil\Read_Excel\planets3.xls";

    v_fName: = WebUtil_File.File_Open_Dialog)

    directory_name = > "C:\". »

    -, file_name = > Get_Form_Property (:System.Current_form, Form_Name) |'. XLS

    , File_Filter = > null

    , Title = > 'Select customer filename to open.'

    );

    IF (v_fName IS NOT NULL) THEN

    -The following sets a communication with the excel worksheet

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

    -Open the OLE application

    application: = Client_OLE2.create_obj ('Excel.Application');

    -Keep the hidden application

    Client_OLE2.set_property (application, 'Visible ','false ');

    workbooks: = Client_OLE2. Get_Obj_Property (application "Filing cabinets");

    args: = Client_OLE2. CREATE_ARGLIST;

    -Open the selected file

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

    Client_OLE2.add_arg (args, v_fName);

    workbook: = Client_OLE2. GET_OBJ_PROPERTY (Workbooks, 'Open', args);

    Client_OLE2.destroy_arglist (args);

    worksheets: = Client_OLE2. GET_OBJ_PROPERTY (workbook, 'Worksheets');

    -Get the number of spreadsheets

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

    num_wrkshts: = Client_OLE2. GET_NUM_PROPERTY (worksheets, 'Count');

    worksheet: = Client_OLE2. GET_OBJ_PROPERTY (application, 'activesheet');

    -Go to the first record

    go_block ('EXCEL_EXPORT_TABLE');

    premier_enregistrement;

    loop

    If: system.record_status <>'NEW' then

    create_record;

    end if;

    When the exit NEM;

    for 1.15 k loop - 15 frames / record - hard-code the length of the column

    args: = Client_OLE2.create_arglist;

    Client_OLE2.add_arg (args, j);

    Client_OLE2.add_arg (args, k);

    cell: = Client_OLE2.get_obj_property (spreadsheet calculation, 'Cells', args);

    Client_OLE2.destroy_arglist (args);

    If Client_OLE2.get_char_property (cell, 'Value') = 'null' then

    cell_value: = ";

    on the other

    cell_value: = nvl (Client_OLE2.get_char_property (cell, 'Value'), 0);

    end if;

    If upper (cell_value) = 'NEM' then - the loop runs until "NEM" are judged.

    Nem: = true;

    Message ('end of data');

    "exit";

    end if;

    Copy (cell_value, name_in ('system.cursor_item'));

    next_item;


    end loop; -for

    j: = j + 1;

    end loop;-main loop

    premier_enregistrement;

    -Release the handles object Client_OLE2

    IF (cell IS NOT NULL) THEN

    Client_OLE2.release_obj (cell);

    END IF;

    IF (spreadsheet IS NOT NULL) THEN

    Client_OLE2.release_obj (Worksheet);

    END IF;

    IF (spreadsheets IS NOT NULL) THEN

    Client_OLE2.release_obj (Worksheets);

    END IF;

    IF (worksheet2 IS NOT NULL) THEN

    Client_OLE2.release_obj (worksheet2);

    END IF;

    IF (workbook IS NOT NULL) THEN

    Client_OLE2.release_obj (Workbook);

    END IF;

    IF (workbooks IS NOT NULL) THEN

    Client_OLE2.release_obj (Workbooks);

    END IF;

    Client_OLE2. Invoke (application, 'Quit');

    Client_OLE2.release_obj (application);

    ON THE OTHER

    Message ("no file selected.'");

    message(' ');

    RAISE Form_Trigger_Failure;

    END IF;

    END;

    Please think it has no integrated to find no records and columns in excel file using oracle forms.

    Thank you and best regards,

    JaKes

    This change according to excel data file.

    for example, we also use this logic. because the first column in excel file still does not empty. It should be full.

    If any column of a raw material can be empty, one with just my solution can be

    v_all_column_str: = col_A_Value | col_B_Value | col_C_Value | col_D_Value |... col_n_value;

    if v_all_column_str is null, then--> you can tell, all of the columns of this vintage in excellent file is empty

  • How do I report the results of the previous record to the next record in a query

    Hello

    For example if I have data of the table as.

    AC_CODE DATE CREDIT DEBIT

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

    1001 15 APRIL 15 10

    1001 APRIL 25, 15 2

    1005 5 APRIL 15 100

    1005 8 APRIL 15 25

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

    And I want to train as below, where, BALANCE = (previous record BALANCE) + CREDIT - DEBIT

    (assuming that NVL (, 0) for all columns)

    (assuming the BALANCE reset after change of AC_CODE)

    DATE AC_CODE CREDIT DEBIT BALANCE

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

    1001 15 APRIL 15 10 10

    1001 APRIL 25 15 2 8

    1005 5 APRIL 15 100 - 100

    1005 8 APRIL 15 25 - 75

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

    (AC_CODE ORDER, DATE)

    Of course, it can be reached using query of database function.  My question is, is it possible by using a query without involving all functions.

    Thank you

    -Anand

    Model clause could help you meet this goal...

    Note: There is a separate area for SQL, PL/SQL issues here in OTN and don't forget to provide insertion, create scripts for your sample data for a quick response

    with t as(select 1001 AC_CODE,to_date('15-APR-2015','DD-MON-yyyy') dt,10 credit,null debit from dual union all
              select 1001,to_date('25-APR-2015','DD-MON-yyyy'),null,2 from dual union all
              select 1005,to_date('05-APR-2015','DD-MON-yyyy'),null,100 from dual union all
              select 1005,to_date('08-APR-2015','DD-MON-yyyy'),25,null from dual
            )
        select ac_code
              ,dt
              ,credit
              ,debit
              ,balance
            from t
            model
                partition by (ac_code)
                dimension by (row_number() over(partition by ac_code order by dt) rn)
                measures (dt,credit,debit,0 as balance)
                rules
                    (
                        balance[any] = nvl(balance[cv()-1],0) + nvl(credit[cv()],0) - nvl(debit[cv()],0)
                    )
            ;
    
  • How I've hidden the elements after the query when moving back to the previous record

    Hello world

    I create a form with the developer 6i and I use set_item_property(item_name,visivile,...), in post_change, in when_list_change relaxation too

    to hidden and activate certain elements.

    When I enter the data, everything works fine, when I do a request for enforcement to the data set and move to the next record every thing works fine, but

    When I want to go back to the previous record, the two triggers does not,

    could someone tell me where to put this code, so it can walk perfecty when I move to the next record or previous record

    best regards;

    You can use one - news - when? -Instance triggers (where? = point, Record, block, etc.).

    Craig...

  • Have down loaded 2015 PS I find previous versions of PS remain on my computer it is possible to delete older versions?

    Having downloaded 2015 PS I find previous versions remain on the computer can they be deleted?

    Yes, feel free to remove them.

    Mylenium

  • Getting value of an element in the previous record in a table

    Good afternoon

    I'll try to explain my problem:

    I have a block table points X, Y and Z (all are elements of database)...

    On the first record, the user is required to set the values for all the elements...

    For the rest of the records, the value of X must be the value of Z in the previous record.

    How I could do and what is the best way to do it?

    Thanks in advance.

    Daniel Guzzo

    OK, problem solved by myself:

    IF: System. CURSOR_RECORD! = 1 and: global .rec_changed = 0 THEN

    : global .rec_changed: = 1;

    PREVIOUS_RECORD;

    : global .fec_hasta: = to_char(:cret_prod_pol_renovacionesb.crpn_fe_hasta,'DD-MM-YYYY');

    NEXT_RECORD;

    : global .rec_changed: = 0;

    IF: global.fec_hasta is null THEN previous_record; end if;

    : cret_prod_pol_renovacionesb.crpn_fe_efectiva: = to_date(:global.fec_hasta,'DD-MM-YYYY');

    -MESSAGE(:global.fec_hasta);

    END IF;

    If anyone has a better solution, it will be welcome.

    Thank you

  • calculate the balance depends on the previous record result

    Hello
    I have a requirement like calculating the balance depends on the previous record result. but I'm unable to accomplish by using select statement.
    Sample data:
    
    WITH T AS (SELECT 10 AMOUNT, 0.2 PERCENT  FROM DUAL
               UNION ALL 
               SELECT 11 AMOUNT, 0.3 PERCENT  FROM DUAL
               UNION ALL 
               SELECT 12 AMOUNT, 0.3 PERCENT  FROM DUAL
               UNION ALL 
               SELECT 13 AMOUNT, 0.3 PERCENT  FROM DUAL
               UNION ALL 
               SELECT 14 AMOUNT, 0.3 PERCENT  FROM DUAL
              )
    process:          
    10(AMOUNT)  *  0.2(PERCENT)  = 2
    11 - 2(Result of previous calculation) = 9
    12 - 9(Result of previous calculation) = 3
    13 -3(Result of previous calculation) = 10
    14 - 10(Result of previous calculation) = 4;
    required output.
     AMOUNT                 RESULT  
      10                          2
      11                          9
      12                          3
      13                         10
      14                          4
    Please, help me build the select statement.

    There is no order in the lines of the relational table. Only ORDER BY guarantees the order. So, even if the AMOUNT is increasing in your sample, I guess in life real amounts are in no particular order. If Yes, you need another column indicating the order of the lines:

    WITH T AS (
               SELECT 1 ID, 10 AMOUNT, 0.2 PERCENT  FROM DUAL UNION ALL
               SELECT 2 ID, 11 AMOUNT, 0.3 PERCENT  FROM DUAL UNION ALL
               SELECT 3 ID, 12 AMOUNT, 0.3 PERCENT  FROM DUAL UNION ALL
               SELECT 4 ID, 13 AMOUNT, 0.3 PERCENT  FROM DUAL UNION ALL
               SELECT 5 ID, 14 AMOUNT, 0.3 PERCENT  FROM DUAL
              )
    SELECT  AMOUNT,
            RESULT
      FROM  T
      MODEL
        DIMENSION BY(ID)
        MEASURES(AMOUNT,AMOUNT RESULT,PERCENT)
        RULES(
              RESULT[1]                  = RESULT[1] * PERCENT[1],
              RESULT[ID > 1] ORDER BY ID = RESULT[CV()] - RESULT[CV() - 1]
             )
      ORDER BY ID
    /
    
        AMOUNT     RESULT
    ---------- ----------
            10          2
            11          9
            12          3
            13         10
            14          4
    
    SQL> 
    

    If the AMOUNT is still growing:

    WITH T AS (
               SELECT 10 AMOUNT, 0.2 PERCENT  FROM DUAL UNION ALL
               SELECT 11 AMOUNT, 0.3 PERCENT  FROM DUAL UNION ALL
               SELECT 12 AMOUNT, 0.3 PERCENT  FROM DUAL UNION ALL
               SELECT 13 AMOUNT, 0.3 PERCENT  FROM DUAL UNION ALL
               SELECT 14 AMOUNT, 0.3 PERCENT  FROM DUAL
              )
    SELECT  AMOUNT,
            RESULT
      FROM  T
      MODEL
        DIMENSION BY(ROW_NUMBER() OVER(ORDER BY AMOUNT) ID)
        MEASURES(AMOUNT,AMOUNT RESULT,PERCENT)
        RULES(
              RESULT[1]                  = RESULT[1] * PERCENT[1],
              RESULT[ID > 1] ORDER BY ID = RESULT[CV()] - RESULT[CV() - 1]
             )
      ORDER BY ID
    /
    
        AMOUNT     RESULT
    ---------- ----------
            10          2
            11          9
            12          3
            13         10
            14          4
    
    SQL> 
    

    SY.

  • Updated column by using a previous record value

    I have data in a table as follows:

    sequence ID
    1 100
    2 101
    102 3
    4 103
    4 104
    5 105
    6 106


    I need increment the value of the sequence of + 10 sequence of the previous record.
    Even if the first value of record sequence will start at only 1.
    i.e.
    sequence ID
    1 100
    10 of 101
    20 102
    30 of 103
    40 104
    50 of 105
    60 106

    Is it possible in a single query.

    Hello
    DDL and DML:

    CREATE TABLE test(col1 NUMBER, col2 NUMBER) 
    
    INSERT INTO test SELECT 100 col1, 1 col2 FROM DUAL UNION
    SELECT 101, 2 FROM DUAL UNION
    SELECT 102, 3 FROM DUAL UNION
    SELECT 103, 4 FROM DUAL UNION
    SELECT 104, 5 FROM DUAL UNION
    SELECT 105, 6 FROM DUAL UNION
    SELECT 106, 7 FROM DUAL
    

    The query:

    UPDATE test a SET col2=NVL((SELECT col2*10 FROM test b WHERE a.col2-1=b.col2),1)
    7 Rows Updated.
    
    SELECT * FROM test
    COL1 COL2
    100 1
    101 10
    102 20
    103 30
    104 40
    105 50
    106 60 
    

    Kind regards
    Lakshmi.

  • MySQL display-only previous Record

    Hello, everyone:

    How is it possible to display the second record in a MySQL table rather than the current.

    Let me show you an example.


    MySQL

    UserAccount (table 1)

    user name, first name last name

    122 of John Smith

    Ferrari Enzo 145

    547 Jane Doe

    895 David Samuel

    account (table 2)

    First_name last_name logindate UserID

    122 John Smith 2011-01-28

    145 Enzo Ferrari 2011-01-12

    547 Unetelle 2011 - 01 - 27

    145 Enzo Ferrari 2011-01-10

    547 DOE 2010-12-22 (A-1 * note only for external reference)

    547 Unetelle 2010 - 12 - 20

    Now when I do a MySQL query to display on my PHP page I only want to show the Jane Doe the previous record in bold red.

    MySQL Query (* Note don't know how the code to display the previous record not current results only)

    SELECT useraccount.userid, useraccount.first_name, useraccount.last_name, account.logindate

    Useraccount ACCOUNT

    WHERE useraccount.userid = account.userid

    PHP page

    Hello Jane Doe, your previous login date was December 22, 2010 (a-1 * note only for external reference)

    Thank you for all your help.

    AdonaiEchad wrote:

    How is it possible to display the second record in a MySQL table rather than the current.

    Use the LIMIT clause with two numbers. The first specifies how many files to jump, the second how much you want to.

    SELECT useraccount.userid, useraccount.first_name, useraccount.last_name, account.logindate
    
    FROM useraccount account
    WHERE useraccount.userid = account.userid
    ORDER BY account.logindate DESC
    LIMIT 1,1
    
  • Records of paint according to the previous record

    Hi all

    I need a bitch the foreground color of a record by a field in the previous record, I mean, if the current record contains the same data as the previous it should be blue, but it is different to be red.

    can anyone tell me how and in which trigger.

    THX!

    In addition Francis... If you block based on SQL query you can use the functions of LAG and LEAD in your SQL to get the previous values in the same line.

Maybe you are looking for

  • Select multiple tabs using the keyboard and mouse

    In short, I used to be able to select several byt tabs, one selected, hold down the Ctrl + Shift and then clicking on the last tab, I want to be added to the selection.The feature seems to have disappeared, is it possible to get it back?

  • Failed to add video files to iTunes

    Hello I have problems with adding video files in iTunes. I use iTunes on a Windows Server 2008R2 x 64-12 GB - lots of disk space It was working fine with iTunes 12.0.1.26 and the only reason why I kept this version was so that I could use the old win

  • PIXMA MG5320 stopped printing black even with new cartridge and a deep cleaning. The colors are OK.

    Some time previously, failure to print quality settings, black would go a little weak on the last few lines of a full page of text. If there are more pages, each would start very well but have the same poor quality near each bottom of page. I changed

  • kb2656351 continues to install - need help to stop it

    I tried several methods recommended to prevent above update, but it has installed more than 20 + times - once per night. First of all, I did the fix method 4 someone kindly referred me to, and then tried to 'fix the Microsoft.Net Framework 4 Client P

  • DeskJet does not print in vista, but...

    Hello. I have a deskjet 2540 and I have 2 computers, 1 with windows vista and the other with windows 8.1. A few days ago, there was a malfunction of the wireless network and 2 computers can no longer print. I went to install the printer on 2 computer