How to write a case statement for the totals column of two different years (2013 and 2014) of the same month so that I can get a +/- column

Please Help!!!
How to write a case statement for the totals column of two different years (2013 and 2014) of the same month so that I can get a +/- column.
                                  January 2014         January
2013                            +/-
                Region   Entry   Exit  Total    Entry   Exit   Total   (Total of Jan2014-Total of Jan2013)
                A               2         3      
40        5       7        30                    40-30= 10

What is a table structure? Sorry cannot test it right now..
SELECT <columns>,(SELECT Total FROM tbl WHERE Y=2014)-(SELECT Total FROM tbl WHERE Y=2013)
FROM tbl
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence

Similar Messages

  • I live in South Africa and I am looking to get a mac book air to help me with all of my schoolwork and presentations. Are there any discounts that students can get and if so how much of a discount?

    I live in South Africa and I am looking to get a mac book air to help me with all of my schoolwork and presentations. Are there any discounts that students can get and if so how much of a discount?

    Hi, actually there is, but you have to inquire according to Apple.com/za website. Here is the statement:
    Student Discounts
    Students, staff and academic institutions are eligible for ongoing discounts on Apple products and solutions. Call 011 535 9080 for further information.

  • How to write optimized select statements for this requirement

    I.     G/L Account No. Info: Get all the list of G/L Account no. , company code and the corresponding long description from SKB1 & SKAT tables based on the G/L Account no. and company code values entered in the selection screen.
    II.     No. of transactions posted: For each of the Company code & Posting date or fiscal year/ period combination, select all document numbers from BKPF table into an internal table. For each of the company code, GL Account no combination find out no. of distinct records in the BSEG table (or combination of BSIK, BSAK, BSID, BSAD, BSIS & BSAS tables) to get the No. of transactions posted.
    III.     For Last posting FY/period: for each G/L account, Company code combination, determine the MAX (Doc. No) in BSEG, and look up the corresponding document in BKPF table to get the last posting FY/Period.
    Thanks,
    Prakash.

    I) with a query (sq01/2) and logical database SDF
    or standard abap RFSKVZ00
    II)a) select bkpf
       b) select count( * ) from bsik...
    III) a)select max( belnr ) from bseg...
         b) selec single monat from bkpf
    A.

  • I am 67 years old and need help this a disgusting company that they can't help the elderly with phone support

    this a disgusting company that they can't give phone support to a 67 year old woman that doesn't understand all this giberish computer

    This is a user to user forum, not Adobe support... ask a question and someone may be able to help
    The information you need to provide when you ask a question is below... sorry... video editing IS fairly technical
    From the Premiere Elements Information FAQ http://forums.adobe.com/thread/1042180
    NOTE - McAfee kills the program http://forums.adobe.com/thread/1460089?tstart=0
    •You MUST use an account with Administrator Privileges to run Premiere Elements
    •(Doing Run as Administrator http://forums.adobe.com/thread/969395 [says Encore and also for "All" versions of Premiere] will sometimes fix "odd" errors)
    •What version of Premiere Elements? Include the minor version number (e.g., Premiere Elements 12 with the 12.0.1 update).
    •What operating system? This should include specific minor version numbers, like "Mac OSX v10.6.8"---not just "Mac"
    •Has this ever worked before?  If so, do you recall any changes you made to Premiere Elements, such as adding Plug-ins, brushes, etc.?  Did you make any changes to your system, such as updating hardware, printers or drivers; or installing/uninstalling any programs?
    •Have you installed any recent program or OS updates? (If not, you should. They fix a lot of problems.)
    •What kind(s) of image file(s)? When talking about camera raw files, include the model of camera.
    •If you are getting error message(s), what is the full text of the error message(s)?
    •What were you doing when the problem occurred?
    •What other software are you running?
    •Tell us about your computer hardware. How much RAM is installed?  How much free space is on your system (C:) drive?
    And some other questions...
    •What are you editing, and does your video have a red line over it BEFORE you do any work?
    •Which version of Quicktime do you have installed?

  • I'm a student. Is there a monthly plan that I can get instead of the yearly plan?

    I've seen that there are monthly plan options, but is there a monthly plan for students?

    No.
    12 month commitment only for the Student and Teacher version.
    Month-by-month is only for the full retail version.

  • I have just bought my first mac and have been told that i can get a free upgrade to lion but it seems that this is only an option in the us and canada, not the uk. is this true?

    i have just bought my first mac and have been told in pc world that i can get a free upgrade to lion, but it would appear that this is only for those in the u.s. and canada. is this true? also from reading the discussions it seems that lion is not a good thing. i am already regretting my decision to go to a mac.

    I have found that both Linux and Mac (unix) are capable of reading "deep" folders while win 32 will have issues, your it people are clearly wrong.  I run a network with both win/mac. And as long as the win servers/pc's that have shares are set to allow apple file sharing in their folder properties.   And the macs are set to allow smb there should absolutely no trouble with you accessing anything across the platforms, heck, from a Mac to a win pc on some occasions you don't even need to include a "domain" name to log on to, and you can create aliases and make your own shortcuts etc... So you don't have to manually connect each time you boot up etc... But that's all personal preferences I suppose.
    All I can tell you is that, I do it on a daily basis managing a small business. So your answer is yes you can.

  • If I have floating values such as 6.3, 6.7, 6.9, 7.1, 7.2 how do I write a case statement to handle that

    How do I write a case statement If I want a case for x < 1.5;   a case for 1.5 <= x <= 3.7;  case for  3.7 < x < 7.2.....etc.   My input is a floating number.
    Thank you.
    Solved!
    Go to Solution.

    smercurio_fc wrote:
    Nice method with the Threshold function. I was not aware of the limitation with -Inf. Odd.
    Actually, my code operates correctly as long as the first element is smaller than all other elements in the array. We don't need any special handling.
    Maybe NaN is not a bug if the array starts with -Inf, because the interpolated index for any number between the second element and -inf will be infinitely close to 1, thus a result of zero can never be obtained (try a first element of -1e50 and you'll always get 1 unless you go to very huge negative numbers).
    The way threshold array is defined, the behavior should be obvious, the problem is assigning a fractional index.
    It is unexpected that an input equal to the second element also results in NaN. That might be a bug. (see image).
    I probably won't post an idea, maybe a bug report after some more thinking...
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    IdeaThresholdArray.png ‏19 KB

  • How to write read dataset statement in unicode

    Hi All,
    I am writing the program using open dataset concept .
    i am using follwing code.
        PERFORM FILE_OPEN_INPUT USING P_P_IFIL.
        READ DATASET P_P_IFIL INTO V_WA.
        IF SY-SUBRC <> 0.
          V_ABORT = C_X.
          WRITE: / TEXT-108.
          PERFORM CLOSE_FILE USING P_P_IFIL.
        ELSE.
          V_HEADER_CT = V_HEADER_CT + 1.
        ENDIF.
    Read dataset will work for normal code.
    when it comes to unicode it is going to dump.
    Please can u tell the solution how to write read dataset in unicode.
    Very urget.
    Regards
    Venu

    Hi Venu,
    This example deals with the opening and closing of files.
    Before Unicode conversion
    data:
      begin of STRUC,
        F1 type c,
        F2 type p,
      end of STRUC,
      DSN(30) type c value 'TEMPFILE'.
    STRUC-F1 = 'X'.
    STRUC-F2 = 42.
    Write data to file
    open dataset DSN in text mode. ß Unicode error
    transfer STRUC to DSN.
    close dataset DSN.
    Read data from file
    clear STRUC.
    open dataset DSN in text mode. ß Unicode error
    read dataset DSN into STRUC.
    close dataset DSN.
    write: / STRUC-F1, STRUC-F2.
    This example program cannot be executed in Unicode for two reasons. Firstly, in Unicode programs, the file format must be specified more precisely for OPEN DATASET and, secondly, only purely character-type structures can still be written to text files.
    Depending on whether the old file format still has to be read or whether it is possible to store the data in a new format, there are various possible conversion variants, two of which are introduced here.
    After Unicode conversion
    Case 1: New textual storage in UTF-8 format
    data:
      begin of STRUC2,
        F1 type c,
        F2(20) type c,
      end of STRUC2.
    Put data into text format
    move-corresponding STRUC to STRUC2.
    Write data to file
    open dataset DSN in text mode for output encoding utf-8.
    transfer STRUC2 to DSN.
    close dataset DSN.
    Read data from file
    clear STRUC.
    open dataset DSN in text mode for input encoding utf-8.
    read dataset DSN into STRUC2.
    close dataset DSN.
    move-corresponding STRUC2 to STRUC.
    write: / STRUC-F1, STRUC-F2.
    The textual storage in UTF-8 format ensures that the created files are platform-independent.
    After Unicode conversion
    Case 2: Old non-Unicode format must be retained
    Write data to file
    open dataset DSN in legacy text mode for output.
    transfer STRUC to DSN.
    close dataset DSN.
    read from file
    clear STRUC.
    open dataset DSN in legacy text mode for input.
    read dataset DSN into STRUC.
    close dataset DSN.
    write: / STRUC-F1, STRUC-F2.
    Using the LEGACY TEXT MODE ensures that the data is stored and read in the old non-Unicode format. In this mode, it is also possible to read or write non-character-type structures. However, be aware that data loss and conversion errors can occur in Unicode systems if there are characters in the structure that cannot be represented in the non-Unicode codepage.
    Reward pts if found usefull :)
    Regards
    Sathish

  • How would I create buttons states for MCs I am creating abstract MCs

    I am creating a generic website that would have abstract MCs that would load jpg or TXT fields for the user interface to allow for fast updates to the site. The MCs that would make up the user interface would be empty and load things into it using XML or PHP later on. How would I create button states for the user interface MCs.  I started creating a function for every MC button state but I thought there might be a more efficient way.
    would creating a array help in this case?
    and is using URLRequest the way to link to pages with in a movie well the flash movie that is the site it's self?
    /*---------------------------- THE START OF MY ACTION SCRIPT ------------------------------*/
    var waywardLogo_mc:MovieClip = new MovieClip;
    var theCollection_mc:MovieClip = new MovieClip;
    var newsPage_mc:MovieClip = new MovieClip;
    var whatthe#$@!doyouwant!?_mc:MovieClip = new MovieClip;
    /*---------------------------- onOver ------------------------------*/
    waywardLogo_mc.addEventListener(MouseEvent.ROLL_OVER,onOver);
    theCollection_mc.addEventListener(MouseEvent.ROLL_OVER,onOver);
    newspage_mc.addEventListener(MouseEvent.ROLL_OVER,onOver);
    whatthe#$@!doyouwant!?_mc.addEventListener(MouseEvent.ROLL_OVER,onOver);
    /*---------------------------- onOut ------------------------------*/
    waywardLogo_mc.addEventListener(MouseEvent.ROLL_OUT,onOut);
    theCollection_mc.addEventListener(MouseEvent.ROLL_OUT,onOut);
    newspage_mc.addEventListener(MouseEvent.ROLL_OUT,onOut);
    whatthe#$@!doyouwant!?_mc.addEventListener(MouseEvent.ROLL_OUT,onOut);
    /*---------------------------- onClick ------------------------------*/
    waywardLogo_mc.addEventListener(MouseEvent.CLICK,onClick);
    theCollection_mc.addEventListener(MouseEvent.CLICK,onClick);
    newspage_mc.addEventListener(MouseEvent.CLICK,onClick);
    whatthe#$@!doyouwant!?_mc.addEventListener(MouseEvent.CLICK,onClick);
    function onOver(event:MouseEvent):void
    event.target.alpha = .5;
    function onOut(event:MouseEvent):void
    event.target.alpha = 1;
    function onClick(event:MouseEvent):void
    event.target.URLRequest("");
    /*---------------------------- onover, onOut, onClick buttonModes ------------------------------*/
    waywardLogo_mc.buttonMode = true;
    theCollection_mc.buttonMode = true;
    newspage_mc.buttonMode = true;
    whatthe#$@!doyouwant!?_mc.buttonMode = true;

    click insert/new symbol, tick movieclip, assign a name, tick export for actionscript and in the class textfield enter a name (say ButtonClass) and click ok.
    attached to the first frame of your new movieclip, type stop() in the actions panel.  put whatever graphic you want on-stage for your button's up stage.  create another keyframe, label it "over" and put whatever graphic you want for button's over state on-stage.
    in a layer above those graphics, you'll probably want to add a dynamic textfield so each of your buttons can have different text.  assign the textfield and instance name (say tf) and extend its timeline to the last frame of your movieclip button.
    then when you want to create a button, on your timeline you can use:
    var b:ButtonClass=new ButtonClass();  // these two lines need to be entered for each button
    buttonhandlerF(b,someX,someY);
    //-------code between dotted lines only needs to be entered once no matter how many buttons you add --------------------
    function buttonhandlerF(b:ButtonClass,x:Number,y:Number){
    b.addEventListener(MouseEvent.MOUSE_OVER,overF);
    b.addEventListener(MouseEVent.MOUSE_OUT,outF);
    b.x=x
    b.y=y
    addChild(b);
    function overF(e:MouseEvent){
    e.currentTarget.gotoAndStop("over");
    function outF(e:MouseEvent){
    e.currentTarget.gotoAndStop(1);
    //-------code between dotted lines only needs to be entered once --------------------
    // you'll also want to create a click listener and listener function
    the code between the dotted lines is amenable to being added to a ButtonClass.as class file if want to expand your capabilities.

  • Windows 8.1 PC, using reader, when searching a folder containing approx 100 doc's. If i search for a word, no results are returned. only the doc names can be found but nothing from within the doc. This is a new problem and was not the case before.

    Windows 8.1 PC, using reader, when searching a folder containing approx 100 doc's. If i search for a word, no results are returned. only the doc names can be found but nothing from within the doc.
    This is a new problem and was not the case before.

    Works perfectly fine for me with the latest Reader version (11.0.09).
    You write that it worked "before"; before what?  An update?  Update from what version to what version?

  • How to obtain a case number for License transfer process

    How to obtain a case number for License transfer process.

    Good to know - Here you have the user-2-user forum for "Adobe Reader".
    For anything "License" related you will want to be using the "contact" feature to meander about until you can get a "licensing work group" point of contact.
    The path starts here:
    Contact Customer Care
    Be well...

  • How to write a Globla Routine for Transfer Rules

    Hi Experts,
    How to write a Global Routine for Tranfer Rules ? Where all the infoobjects need to be grouped? Effect need to be shown on group of fields that are available in a single structure.
    Thanks in Advance
    Vara

    Hi,
    Are you aware of Start Routine available?.. This helps to write a routine on all the infoObjects available in Transfer Structure
    http://help.sap.com/saphelp_nw04/helpdata/en/b3/0ef3e8396111d5b2e80050da4c74dc/frameset.htm
    regards
    Happy Tony

  • How to create nested CASE statements in PL/SQL

    Can anyone please tell how to create Nested CASE statements in PL/SQL with proper syntax?
    It would be better if you can help with an example.
    Thank you!

    Something like this:
    SQL> set serveroutput on
    SQL> declare
      2    v1 number := 2;
      3    v2 varchar2(1) := 'C';
      4  begin
      5    case v1
      6      when 1 then dbms_output.put_line('First');
      7      when 2 then begin
      8                    case v2
      9                      when 'A' then dbms_output.put_line('Found A');
    10                      when 'B' then dbms_output.put_line('Found B');
    11                      when 'C' then dbms_output.put_line('Found C');
    12                      else dbms_output.put_line('NONE');
    13                    end case;
    14                  end;
    15      else dbms_output.put_line('Else');
    16    end case;
    17  end;
    18  /
    Found C
    PL/SQL procedure successfully completed
    SQL> If you have further doubts regarding syntax you can read the docs on the Case statement here:
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10472/case_statement.htm

  • Neeed help to write a case statement

    I want to write a case statement such that
    i have four name sunny,katie,linda,scott in which sunny is the manager
    the rek is that under sunny if katie,linds scott falls then i need to show "yes" in coloumn other wise "no"
    like
    case when cn1.sunny=cn2 in(katie,linda,scott) then 'y' else 'n'
    Edited by: user13001889 on Jun 20, 2011 1:04 PM

    What is a table structure? Sorry cannot test it right now..
    SELECT <columns>,(SELECT Total FROM tbl WHERE Y=2014)-(SELECT Total FROM tbl WHERE Y=2013)
    FROM tbl
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • How to trace every dml statement for a schema/ database

    hi,
    how to trace every dml statement for a schema/ database
    PFile Entrie
    init.ora Parameter Example event='1401 trace name errorstack, level 12';
    tkprof orcl_ora_3632.trc b.txt
    after these two steps I am not able to see the sql statements in trace ...
    Please suggest.
    Thanks & Regards,

    Hi,
    Trace Event 1401 will create a trace file and dumps the information when ORA-01401 error occurs. This error occurs when "inserted value too large for column"
    You will see the trace file getting populated only when you encounter ORA-01401 error.
    Regards

Maybe you are looking for

  • New IPOD nano and getting HKEY_LOCAL_Machine\software\Classes\quicktime

    I tried to install the software for my new iPod Nano and it would nto load for this message: could not open key: HKEYLOCALMACHINE\Software\Classes\QuickTime,QuickTime\CLSID. Verify that you have sufficient access to that key, or contact your support

  • Colour profiles problem - images saving too dull. Please help.

    I realise you have probably had this question a million times before and I have looked at enough related threads, but I am still at a loss as to what to do. Please note I'm not the most computer-savvy. For the record I am using Photoshop 7 (yes it's

  • HT1390 Report problem with movie rental

    I rented the movie "Hunger Games". After the download had completely finished I wanted to watch the movie in iTunes and had trouble, the sound was on and off, the picture sometimes blurry and interrupted. How can I report a problem in movie rentals?

  • New comp, geek squad removed all songs, how do I get those back?

    My old hard drive crashed along with 200 something songs. Geek squad was setting up my new computer and he updated my iPod so that the only songs on it now are the sample songs from my computer. I had planned on buying the old songs again, but the Mu

  • Stocks App Stopped Working Properly

    The Stocks App on my 3G iPhone has recently stopped working properly. When I open it, the current share prices all still come up as expected, but the numbers at the right hand side in the green and red boxes where it tells you the + or - shift for th