Add two numbers

I have a table with two columns:

colA, colB
-----------------------
1 2012
2 2012
12 2011
11 2011


The two columns are numbers, however, colA stores year-round and colum B the month
Now, I want to add these love:
1st row should translate 201201
2nd should translate 201202
in 201112 3rd & 4th in 201111... How could I do that? simple add the two columns is not the solution, because the first row would result in 20121.
Pls advice!

You could do something like

colA * 100 + colB

Store date values (or parts of date values) in the separate numeric columns and then try to date arithmetic on these numerical values are almost always a mistake. Why you store the data in this way in the first place? Why don't we just save the data as a date?

Justin

Tags: Database

Similar Questions

  • Add two numbers without the use of variables?

    Hi, I have yet another simple problem that I tried to solve 10 different ways, and nothing works. I am trying to add up the numbers of two text entry fields when the user presses the left arrow key on the keyboard. I try to avoid typing just the names in the boxes of Var formatting text fields are slightly different. Here is my current code, I have attached to the button:

    on {(keyPress '< Left >')
    var WagerA = int (_root. AWager.text);
    var moderateto = int (_root. Ascore.Text);
    WagerA + moderateto;

    }

    Try to use...

    var keyListener:Object = new Object();
    Key.addListener (keyListener);

    keyListener.onKeyUp = function() {}
    If (Key.GetCode () == Key.LEFT) {}
    trace ("left"); use for testing

    Insert your code here
    }
    }

    Copy the following code will work for the left key, which will demonstrate the trace.  If it does not cover your data of textfield, then the problem is most likely with the textfields

  • How can I add two pages just before page 7 of the book, which will change all the page numbers that follow?

    Hello

    I'm close to finishing a book of 257 pages.  All pages are numbered automatically down, and I spent a few weeks carefully constructed an Index at the end of the book that has all the right page numbers listed for everything.  So whatever I do, I can't change my page numbers.

    But at this late stage, I would like to add a few epigraphs (quotations) in four or five places (I just got this idea today, I'm afraid).

    Is it possible to add a few pages here and there (I will add two pages at a time, I know, or he'll hit all the pages that follow, half of them designed to be left, and half designed to be on the right - off) that are not numbered, and that will not affect the numbering of the following pages?

    Kind regards

    Malcolm

    It is not Automatic way. If you are ready to have unnumbered pages which are not included in the number of pages, you can, for each page the inserted value

    (1) select the first page after the pages will be added

    (2) in the menu pages palette, use the Options Section and number and the page number of started with the value what it is already. In this way, adding pages will not affect the numbering.

    (3) in order to avoid conflicts with the new pages page number, set their numbering on something else as 1,2,3. (as i, ii, iii, for example)

    For later use, you can configure your index with the indexing of InDesign tools, if a false problem, as you would have been able to add the pages and then re - automatically generate a correct index.

  • Just add 2 numbers.

    Adding 2 numbers 3 textfields with a button, I can do. The first textfield for one entry, the second for two input and the third for the output (result). The button of the operation.

    recently, some of you have helped me with the calculation of the square root. As you can see below:

    http://www.er.UQAM.ca/Nobel/m340201/test/newestcalc.html

    My question now, how can I add 2 numbers only with a textfield (result) and 4 buttons. A button for the number 1, another for the number 2, one for the operator + and finally one for the = sign.

    I have the code and being new to this I can't figure out how to put everything to work:

    import flash.events.Event;
    var txt_inp:TextField = new TextField();
    txt_inp.Type = "input";
    txt_inp.x = 168.95.
    txt_inp.y = 51.10;
    txt_inp. Width = 209;
    txt_inp. Height = 52,90;
    txt_inp. Border = true;
    txt_inp. BorderColor = 0x0000da;

    txt_inp. Restrict = "0-9";
    var myFormat:TextFormat = new TextFormat();
    myFormat.size = 44;//myFormat.align = TextFormatAlign.CENTER;
    myFormat.align = TextFormatAlign.JUSTIFY;
    txt_inp.defaultTextFormat = myFormat;
    txt_inp. TextColor = 0x0000FF;


    txt_inp.maxChars = 5;
    txt_inp. Multiline = false;
    txt_inp. Text = ";
    addChild (txt_inp);

    var num1:Number;
    var num2:Number;

    Button1.addEventListener (MouseEvent.CLICK, fl_MouseClickHandler);
    Button2.addEventListener (MouseEvent.CLICK, fl_MouseClickHandler);


    function fl_MouseClickHandler(e:MouseEvent):void
    {
    txt_inp. AppendText (e.currentTarget.Name.substr (6));
    }

    buttonplus.addEventListener (MouseEvent.CLICK, fl_MouseClickHandler_5);

    function fl_MouseClickHandler_5(event:MouseEvent):void
    {

    trace ("mouse clicked");

    }

    equale.addEventListener (MouseEvent.CLICK, fl_MouseClickHandler_6);

    function fl_MouseClickHandler_6(event:MouseEvent):void
    {

    trace ("mouse clicked");

    }

    If you want the result to appear in the use of textfield:

    the var sum: number;

    var nA: Array = [];

    stage.addEventListener (KeyboardEvent.KEY_DOWN, keyF);

    function keyF(e:KeyboardEvent):void {}

    48-57, 96-105

    var n:int=e.keyCode%48;

    If (n > = 0 & n)<=9)>

    nA.push (n);

    }

    }

    buttonplus.addEventListener (MouseEvent.CLICK, plusF);

    function plusF(event:MouseEvent):void {}

    sum = nA.pop ();

    }

    equale.addEventListener (MouseEvent.CLICK, equalF);

    function equalF(event:MouseEvent):void {}

    sum += nA.pop ();

    txt_inp. Text = String (Sum);

    }

  • What can I add two external hard drives?

    My most recent iMac has a Thunderbolt port and I have a bolt of lightning > FW 800 adapter. I have also 3 HDDs that still have firewire 800 (they actually also have USB, but it's only USB2, so this isn't an option). Is is allowed to add two (one using the FW cable adapter and then use a FW cable to connect two readers) as I sometimes like to copy things from one to the other.

    Yes, but the second disc will probably need to have its own power supply.

    (140900)

  • I want to improve memory on iMac 27 in. 3.3 GHz, 5K retina. He now has two 4G of Ram. I want to add two 8 G of ram. Should I remove two 4 G, or simply add 8G in two empty slots? Going to have a mixed match (2 of 4 and 8 s 2) in trouble?

    I want to improve memory on iMac 27 in. 3.3 GHz, 5K retina. There are now two 4 G of Ram. I want to add two 8 G of ram. Should I remove two 4 G, or simply add 8G in two empty slots? There are 4 slots for RAM.  Going to have a mixed match (two 4 and two 8) in trouble? Or will it improve my speed giving me 24G of RAM?

    It will be fine as long as they are installed in pairs (and, as long as your model can handle 8 GB modules). Just install them in the empty slots. Working with word documents or online will be not much faster - you will notice the difference in speed apps to respond, with graphic design and video editing, etc or game play. The new OS versions like more RAM, so you can not go wrong there.

    FYI, you do not run iOS on an iMac - Please edit your profile to show what OS version you are using. It helps the helpers.

  • Pavilion Beats special edition: is it possible to add two monitors to my laptop specific and if so, how?

    Hello. I have a laptop 15-p058na with 1 x HDMI, 1 x USB 2 and 2 x USB 3. Ideally, I want to be able to add two screens to display separate sites or other applications, but I don't know if this model which will support or if I can just add a monitor.  I would be grateful for any advice. Graphics card is the AMD Radeon HD8510G graphics card if that helps. Thank you very much

    Well there is only one monitor on the laptop, the HDMI port but we USB 3.0 to HDMI adapters that work quite well and will allow another monitor to add.

    https://www.Amazon.com/STARTech-external-monitor-adapter-USB32HDES/DP/B00H91BQ7Y/ref=sr_1_1?ie=UTF8&QID=1478001840&SR=8-1-spons&keywords=USB+3.0+to+HDMI&PSC=1

    If it's 'the Answer' please click on 'Accept as Solution' to help others find it.

  • Add two images

    I would like to add several images (images = object of the labview data accessed through Grahpics & sons-> functions of photo).  Right now I can use an image as an entry to a photo function (for example, draw Rectangle, or a circle to draw), and I can cascade of the different drawing commands in order to get a composite image.  But I would like to store different images that I use for overlays of graphic intensity and enable or disable them for the user.  It seems that if a function to add two pictures, which seems to be intrinsic to all the drawing vi, must exist but I can't find it anywhere.  Does one exist?

    Thank you

    Doug

    Looks like "String concatenate" made the turn.  Who would have thought images were strings? And can be concatenated?  NEITHER can make it easier to find in the documentation it is already there.  Or add if not.

  • Find the difference between two numbers (DBL)

    Hi all

    Is there a function in labview other than the subtraction function that can find the difference between the two numbers given?

    Thank you

    Davidson


  • When I subtract two numbers DBL and try to compare the result with another DBL, it fails

    I found a curious problem with subtraction and compare numbers DBL in LabVIEW (8.6). Here's how it works:

    1. subtract two numbers DBL such that the result is not incorporated. (Say, 3.2 - 3.1)

    2. compare the result with a constant/control that is on the result of the subtraction (in the example, 0.1)

    3 see the output of the comparison.

    If the result of the subtraction is an integer, the Boolean result is (as expected). If the result is not complete, the comparison fails.

    (Now, if I simply compare two floating point numbers, it works, so the issue is not with the node comparison itself, but with the data that is entered to the node). Can someone understand why this happens? It's unexpected, it's a pretty serious bug.

    It is provided with all programming languages. Numbers do not have an exact binary floating-point representation. This has been discussed endlessly. Never use the equal function with floats. You can use the function in the range and force.

  • The product key label is worn and missing two numbers. How can I get back them so I can re - install the software?

    missing numbers

    The product key label is worn and missing two numbers. How can I get back them so I can re - install the software? The hard drive broke down.

    Thank you.

    How to identify, locate, and replace a product key
    http://support.Microsoft.com/kb/811224

  • Windows Movie Maker-how add two or more music/songs to different scenes in a film

    Director of Windows (audio / music), two or more pieces to add to the same film. a part of a song to be added as the Crter trim option but for music files

    1. how to add two or more music/songs on different places in a movie?

    2. do movie maker has the possibility to take part of a file of music/song to be added to a scene (like the trim option behind the scenes clip), for example if I imported an entire song but I need a specific part to be included in a scene, filmmaker support this or I need to do it on another software before in movie maker?

    1. how to add two or more music/songs on different places in a movie?

    2. do movie maker has the possibility to take part of a file of music/song to be added to a scene (like the trim option behind the scenes clip), for example if I imported an entire song but I need a specific part to be included in a scene, filmmaker support this or I need to do it on another software before in movie maker?

    ====================================
    The layer of the audio files on a single clip... Add an audio file...
    Save the project as a WMV video file, re-import the WMV
    film of the file and add another audio file.

    To save in a .wmv movie file...
    Type of... CTRL + P to open the movie recording Wizard.
    Choose... My computer.
    Next /.
    Enter a name and a location.
    Next /.
    ICT... "Best quality for my computer.
    Next /.
    Wait while the movie is saved.
    Finishing...

    To add a specific part of an audio file... divide and
    delete the unwanted part.

    "Split a Clip.

    Drag the video/audio clip to the
    Timeline.

    Read the video/audio by clicking on the
    "Play" button under the display screen.

    You will see the playback indicator
    (vertical line), advancing through the
    timeline.

    Click on the button "Pause" to the point
    where you want to split and type...
    CTRL + L or click the "Split" button to the
    at the bottom of the display screen.
    (you can also make adjustments to)
    Drag the playback indicator)

    Make splits as much as you want and
    remove unwanted in law clips
    Click on / delete.

    And... Movie Maker 2.1 one poster each
    another framework. To see all the images, the
    PapaJohn information suite may be useful:

    ===

    Movie Maker 2 shows you all-other-frame
    When you perform the installation of project. MM1 and film
    Machine running Vista show you each image.

    It is usually not a problem when ignoring him
    Middle managers, but sometimes you
    Note a flickering image in a clip that is a "stray,"
    and you can not see or cut it out.

    If you apply the Slow - Down - half video effect
    to an item in the timeline panel, you will see
    each image rather than everyone. You
    can see the frame problem and divide it out.
    Remove the effect of the clamp to return
    It's normal.

    Volunteer - MS - MVP - Digital Media Experience J - Notice_This is not tech support_I'm volunteer - Solutions that work for me may not work for you - * proceed at your own risk *.

  • v, can add two horizontalFieldmanager in a horizontalfieldmanager

    Hello

    I want labelfield and editfield one under the other.

    and I want to add bitmap border combining two fields... If I want to add two horizontalfield in unique horizontalfield.

    is it possibble?

    «I want labelfield and editfield one under the other.»

    below?  So, you want a vertical zone manager you?

    I imagine that you have two HFM, each with a label and an EditField and you want these below the other.  Add you them to an optimization of resources and then put the following border around a resources optimization.

    Once you start to need to do this sort of thing, you really should look at:

    http://supportforums.BlackBerry.com/T5/Java-development/create-a-custom-layout-manager-for-a-screen/...

  • Add two hotmail address

    I want to add two different hotmail address to my tablet of suface

    Hi Tony,.

    To help you to propose measures to solve the problem, I would appreciate if you could answer the following question:

    What mail client do you use? Is - this Mail App Office home & student 2013 or Windows Live Essentials?

    If you use the Mail application, see the following article that talks about the addition of e-mail account in the Mail application:

     

    Installation and use of the mail

    http://www.Microsoft.com/surface/en-us/support/email-and-communication/mail

     

    Hope this information helps. Reply with more information about the issue so that we can help you better.

  • How to add two lines when the second row is not visible, but also gets the first data line too?

    Mr President

    Jdev worm is 12.2.1

    How to add two lines when the second row is not visible, but also gets the first data line too?

    I want to add two lines like below picture, but want the second to remain invisible.

    tworows.png

    I asked this question but my way of asking was wrong, that's why for me once again.

    Concerning

    Try to follow these steps:

    1. in the database table to add the new column "JOIN_COLUMN" and add the new sequence "JOIN_SEQ".

    2. Add this new column in the entity object. (You can add this in entity object by right clicking on the entity object and then select "Synchronize with database" then the new column and press on sync)

    3. in your bookmark create button to create only one line NOT 2 rows.

    4 - Open the object entity--> java--> java class--> on the entity object class generate and Tick tick on the accessors and methods of data manipulation

    5 - Open the generated class to EntityImpl and go to the doDML method and write this code

      protected void doDML(int operation, TransactionEvent e)
      {
        if(operation == DML_INSERT)
        {
          SequenceImpl seq = new SequenceImpl("JOIN_SEQ", getDBTransaction());
          oracle.jbo.domain.Number seqValue = seq.getSequenceNumber();
          setJoinColumn(seqValue);
          insertSecondRowInDatabase(getAttribute1(), getAttribute2(), getAttribute3(), getJoinColumn());
        }
    
        if(operation == DML_UPDATE)
        {
          updateSecondRowInDatabase(getAttribute1(), getAttribute2(), getAttribute3(), getJoinColumn());
        }
    
        super.doDML(operation, e);
      }
    
      private void insertSecondRowInDatabase(Object value1, Object value2, Object value3, Object joinColumn)
      {
        PreparedStatement stat = null;
        try
        {
          String sql = "Insert into table_name (COLUMN_1,COLUMN_2,COLUMN_3,JOIN_COLUMN, HIDDEN_COLUMN) values ('" + value1 + "','" + value2 + "','" + value3 + "','" + joinColumn + "', 1)";
          stat = getDBTransaction().createPreparedStatement(sql, 1);
          stat.executeUpdate();
        }
        catch (Exception e)
        {
          e.printStackTrace();
        }
        finally
        {
          try
          {
            stat.close();
          }
          catch (Exception e)
          {
            e.printStackTrace();
          }
        }
      }
    
      private void updateSecondRowInDatabase(Object value1, Object value2, Object value3, Object joinColumn)
      {
        PreparedStatement stat = null;
        try
        {
          String sql = "update table_name set column_1='" + value1 + "', column_2='" + value2 + "', column_3='" + value3 + "' where JOIN_COLUMN='" + joinColumn + "'";
          stat = getDBTransaction().createPreparedStatement(sql, 1);
          stat.executeUpdate();
        }
        catch (Exception e)
        {
          e.printStackTrace();
        }
        finally
        {
          try
          {
            stat.close();
          }
          catch (Exception e)
          {
            e.printStackTrace();
          }
        }
      }
    

Maybe you are looking for