Get the Last Value of Status Field from SQL TABLE using SQL 2008

I have a table with Fields such as
UploadstartTime, UploadEndtime, STATUS From TBLA.
The STATUS Field, has values =7 and 11 are failed and 12 is SUCCESS. I cannot do a max, since it will always show 12, I need to get the MAX(UPLOADENDTIME, and get STATUS For that record. How can I do that using 1 SQL Query?
My current code is: The issue is
select
  TBLNAME
MaxUploadstarttime
=
max(UploadStartTime),
MaxUploadEndtime
=
max(UpLoadEndTime),
     Status=max(status)
from  DB.DBO.LOGTABLE
p1

Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. You failed! Temporal
data should use ISO-8601 formats. Code should be in Standard SQL as much as possible and not local dialect. 
This is minimal polite behavior on SQL forums. 
>> I have a table with Fields such as <<
Fields are not columns! There is no generic status in RDBMS. Putting “tbl-” in a table name is called tibbling and we make fun of people who do it (Google Phil Factor's humor columns. If you were polite is this what you wanted to post? 
CREATE TABLE Something_Uploads
(upload_source_name CHAR(15) NOT NULL,
 upload_start_timestamp DATETIME2(0) NOT NULL,
 PRIMARY KEY (upload_source_name, upload_start_timestamp),
 upload_end_timestamp DATETIME2(0),
 CHECK(upload_start_timestamp < upload_end_timestamp),
 upload_status INTEGER NOT NULL 
   CHECK (upload_status IN (7,11,12, ..))
>> I cannot do a max, since it will always show 12, I need to get the MAX(UPLOADENDTIME, and get upload_status For that record [sic]. How can I do that using 1 SQL Query?  <<
Since you told us nothing and gave no sample data, want to correct this postign? 
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL

Similar Messages

  • How to get the last value edited by users from JTable?

    Hi.
    I have a JDialog that includes an editable JTable. This table is used to set up field caption and font for a report program. I found only when cursor is moved to another cell, the value in current cell being edited will be transferred to Table Model. So if the user don�t move cursor to another cell after editing the value of a cell but click OK button directly, Table Model cannot get the last value edited by the user, I wonder if there is a way to fire JTable to transfer the value being edited to Table model.
    By the way, I found if the TableCellEditor is using JCheckBox or JComboBox instead of JTextField, there is no this problem.
    Thank you for any reply.

    I guess you can make use of the following methods on your table model to inform it make it getValueAt bcos table data has changed.
    fireTableCellUpdated
    Notifies all listeners that the value of the cell at [row, column] has been updated.
    fireTableChanged
    Forwards the given notification event to all TableModelListeners that registered themselves as listeners for this table model.
    fireTableDataChanged
    Notifies all listeners that all cell values in the table's rows may have changed. The number of rows may also have changed and the JTable should redraw the table from scratch. The structure of the table (as in the order of the columns) is assumed to be the same.
    But when to call these methods??
    -- When OK button is pressed, do this as the first thing!!
    OR
    -- Call this on every key event!!
    regds,
    CA

  • Where does FireFox get the default value of a preference from. What is the format of the file that has the default value?

    Where does FireFox get the default value of a preference from. What is the format of the file that has the default value?. I need the actual default value for a particualr preference.
    About:config does show some default values but I need the source from which about:config picks up the default value.
    Any help in this direction is greatly appreciated.
    == User Agent ==
    Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x64; Trident/4.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)

    The prefs that aren't hidden if they are the default are stored in two JavaScript text files in the Firefox program folder
    You can open them via these links in a Firefox tab:
    <code>resource:///defaults/pref/firefox.js
    resource:///greprefs/all.js
    </code>
    ([/forum/1/702598])

  • JTable problem : how to get the last value entered by user + event lost

    Hi all,
    I have 2 problems with Jtable class.
    1 => To get the last value entered by user in a cell,
    it seems that we must change the selected cell.
    That is to say we can only have the previous cell's value.
    Is there a simple way to get the current value of any cell ?
    2 => To resolve the problem i store the values of each cell in a vector and i intercept keyboard event (!)
    BUT, when i do a double click with the mouse on the Jtable, i loose keyboard events. Then, i can't intercept them.
    Is it a bug of swing or am i following a wrong way ?
    Thanks by anticipation for your help.

    You have to fire the "TableCellUpdatedEvent"
    and override the getCellEditorValue in TableCellEditor to return the current value

  • Sequence get the last value (or store the .NEXTVAL anywhere)

    Hi there,
    I created some tables and one table references the other (foreign key).
    Now I want to add some test data and insert rows to both tables.
    My problem is:
    The "insert into command" for table a uses a sequence value to create the primary key. Now I need the assigned primary key in my second insert command to assign the right value to the foreign key.
    Is there a way to get the last assigned value from a sequence? Or can I store the key to some sort of variable and use this in both statements?
    Thx a lot
    Dominik

    Is there a way to get the last assigned value
    from a sequence?
    NEXTVAL return next available value in the sequence.
    If you want last returned value you need to use
    CURRVAL instead.
    >SELECT <your_sequence>.CURRVAL from dual;Peter D.Currval not work always, read the following example :
    Re: auto generating primary key
    Nicolas.

  • How to display the last value of a field in a group in the group header

    I need to display the last quiz score from a group of quiz scores as part of the header of a group of units (the quiz score values are in the detail record).  I can not use the group footer, which would be the natural place to find the last value.  It must be in the group header because there will be a subsequent group within the unit group.  In other words, the grouping is as follows:
    Unit Group Header (Display last quiz score in unit)
    SubUnit Group Header (Display other detail summaries)
    Detail Record (including quiz score)
    SubUnit Group Footer
    Unit Group Footer
    While there is a minimum/maximum summary function, there is not a first/last function.
    Fuskie
    Who is constantly amazed at the ability of users to request report features that are not easily implented through Crystal Reports...

    Hi Fuskie,
    One suggestion to display the last quiz score in the Group Header, other than what had already been suggested, will be to use a linked subreport in the Group Header. It is not an efficient way to display the information, but it could do the trick.
    Another suggestion will be to insert a subreport in the report header, then store the last quiz score in an array for each group, then share it with the main report and display the  values in the appropriate group. In this way it will only connect twice to the data source, one for the main report and once for the subreport, instead of multiple connection for each group.
    Finally, the most efficient way will be to have this value calculated on the database side using a command object or a stored procedure.
    Patrick

  • LiveCycle DS , can't get the return value of fill( arg) from Assembler class

    Hi all!
    I'm a have small problem , can any one help me? Please
    I make a project which very similar to Product project(in
    example).
    1) Have Assembler class: I work correctly
    package flex.samples.stock;
    import java.util.List;
    import java.util.Collection;
    import java.util.Map;
    import flex.data.DataSyncException;
    import flex.data.assemblers.AbstractAssembler;
    public class StockAssembler extends AbstractAssembler {
    public Collection fill(List fillArgs) {
    StockService service = new StockService();
    System.out.print(fillArgs.size());
    return service.getStocks();
    public Object getItem(Map identity) {
    StockService service = new StockService();
    return service.getStock(((Integer)
    identity.get("StockId")).intValue());
    public void createItem(Object item) {
    StockService service = new StockService();
    service.create((Stock) item);
    public void updateItem(Object newVersion, Object
    prevVersion, List changes) {
    StockService service = new StockService();
    boolean success = service.update((Stock) newVersion);
    if (!success) {
    int stockId = ((Stock) newVersion).getStockId();
    throw new DataSyncException(service.getStock(stockId),
    changes);
    public void deleteItem(Object item) {
    StockService service = new StockService();
    boolean success = service.delete((Stock) item);
    if (!success) {
    int stockId = ((Stock) item).getStockId();
    throw new DataSyncException(service.getStock(stockId),
    null);
    some require class is ok.
    2) I configure in data-management-config.xml
    <destination id="stockinventory">
    <adapter ref="java-dao" />
    <properties>
    <source>flex.samples.stock.StockAssembler</source>
    <scope>application</scope>
    <metadata>
    <identity property="StockId"/>
    </metadata>
    <network>
    <session-timeout>20</session-timeout>
    <paging enabled="false" pageSize="10" />
    <throttle-inbound policy="ERROR" max-frequency="500"/>
    <throttle-outbound policy="REPLACE"
    max-frequency="500"/>
    </network>
    </properties>
    </destination>
    3) My client app:
    I use :
    <mx:ArrayCollection id="stocks"/>
    <mx:DataService id="ds" destination="stockinventory"/>
    ds.fill(stocks); --> Problem here
    When I run this app, The StockAssembler on the server work
    correctly (i use printout to debug) . But variable stocks can't get
    the return value,it is a empty list.
    Please help me!

    Hi,                                                             
    The executeQueryAsync method is “asynchronous, which means that the code will continue to be executed without waiting for the server to
    respond”.
    From the error message “The collection has not been initialized”, which suggests that the object in use hadn’t been initialized after the execution of the executeQueryAsync method.
    I suggest you debug the code in browser to see which line of code will throw this error, then you can reorganize the logic of the code to avoid using the uninitialized object.
    A documentation from MSDN about Using the F12 Developer Tools to Debug JavaScript Errors
    for your reference:
    http://msdn.microsoft.com/en-us/library/ie/gg699336(v=vs.85).aspx
    Best regards
    Patrick Liang
    TechNet Community Support

  • JTable: How to get the last value entered ?

    I have a JTable, with 2 columns and 3 rows that I need to fill..
    If I don't press the Enter key after filling each cell, and if I call the foloowing method
    void readTable()
          String[][] myarray = new String[3][2]; 
           for (int i = 0 ; i<3;i++)
            for (j=0 ; j<2; j++)
             myrray[i][j]  = (String) table.getValueAt(i, j);
    }the last returned value is null.
    Is it possible to simulate the Enter key by program (or any other way) to make sure to get the last edited cell value, whether or not the user press the enter key before clicking on a button (for example) to execute the above code. ?
    Thanks a lot for help
    Gege

    Thanks Camikr, using
    table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);works fine. It's exactly what I was looking for.
    Thanks again.
    Gege

  • How to retrive the blob data from a table using sql query

    Hi gurus,
    I have a table which has " BLOB "content in a column .I want to view the data From BLOB column using sql query .It would be helpfull If some one share their idea.
    Regards,
    vardhani.

    You can use data templates.
    See this: http://blogs.oracle.com/xmlpublisher/entry/blob_clob_raw_and_looooong
    http://blogs.oracle.com/xmlpublisher/entry/inserting_blobs_into_your_repo
    Thanks,
    Bipuser

  • HOW TO GET THE SELECTED VALUE IN A ROW FROM ONE VIEW TO ANOTHER VIEW?

    hi all,
    I  have a small issue.
    i have created two views.In the table of the first view i'm selecting a row and pressing the button it will move to next view.
    i am adding some fields manually in the table of the second view and pressing the save button.Here all the values should get updated corresponding to the field which i have selected in the first view.
    I want to know how to get the particular field in the selected row from one view to another view.
    Kindly help me.

    Hi,
            Any data sharing accross views can be achiveved by defining CONTEXT data in COMPONENT CONTROLLER and mapping it to the CONTEXT of all the views. Follow the below steps.
    1. Define a CONTEXT NODE in component controller
    2. Define same CONTEXT NODE in all the views where this has to be accessed & changed.
    3. Go to CONTEXT NODE of each view, right click on the node and choose DEFINE MAPPING.
    This is how you map CONTEXT NODE and same can be accessed/changed from any VIEW or even from COMPONENT CONTROLLER. Any change happens at one VIEW will be automatically available in others.
    Check the below link for more info regarding same.
    [http://help.sap.com/saphelp_nw04s/helpdata/EN/48/444941db42f423e10000000a155106/content.htm]
    Regards,
    Manne.

  • How to get the previous value of a field before saving the record

    Hi All,
    I have a requirement like, listing out the modified field values with their previous value and new value using integration events or any method.
    For Ex: If i modify the customer name from "Jack" to "Amith" in the record.
    Then i have a requirement to display the message like : CustomerName has changed from "Jack" to "Amith"
    Please post your help notes on this.It's Urgent.
    Thanks & Regards
    Amith

    Hello Amith,
    How does a user perform the modification? Do you already have access to the existing value when the user makes the update? How are you identifying the record to be updated within CRMOD and what method are you using to perform the update?
    Thanks,
    Sean

  • How can i get the last delete picture's info from tlf?

    if i delete the picture from the tlf i can't make the tlf undo
    and I want to get the picture'info with I last time delete from tlf 

    Can you let us know what you are doing to delete the picture, and also how you are undoing it? If it is being deleted through the EditManager delete function, the delete should undo correctly. Some example code to illustrate the problem would help.
    Once the picture has been deleted, TLF has no further reference to it. If you want to keep a reference, you will have to get it before it has been deleted. If you don't have control over the delete, you could find out when the image is deleted by listening for FLOW_OPERATION_END events.
    - robin

  • To get  the net value  by subtracting discount from total

    Hi all
    I have an issue in the report I am using oracle reports 6i
    i have a total_services field which is a summary column (CS_1) AND a discount_field which is a formula column (cf_1)
    the requirement is to get total_services - discount value
    i created another formula column NMAD1 with the following formula (sub_dis_ser is a placeholder column of NUmber datatype i created)
    function NetserFormula return nUMBER is
    begin
       :sub_dis_ser  := :CS_2 - :CF_1;
       return(:sub_dis_ser);
    end;this is the code for CF_1, in which i have included a placeholder column CP_6 i created
    function DiscFormula return Number is
    begin
       if  nvl ( :Dis_per1 ,0 ) <> 0     then
                      :CP_6  :=  :TOT_INV_SER - (  :TOT_INV_SER * nvl (:Dis_per1,0) /100 ) ;
       elsif  nvl ( :DIS_VAL1  ,0 ) <> 0    then
                :CP_6  :=  :TOT_INV_SER - nvl ( :DIS_VAL1 ,0 ); 
       Else
                 :CP_6  :=  :TOT_INV_SER ;
               Return ( null  ) ;
       End if ;
               Return ( null  ) ; 
    end;i am getting blank data
    kindly guide me
    thanking in advance
    Edited by: makdutakdu on May 13, 2013 10:33 AM
    Edited by: makdutakdu on May 13, 2013 12:16 PM

    Hi,
    Are you getting any compilation errors in this function..
    function DiscFormula because what is that you wanted to perform in this if condition?
      if  nvl ( :Dis_per1 ,0 )  0     then ....your if statement seems to compare nothing like this   if  nvl ( :Dis_per1 ,0 ) > 0     then... Regards,
    Archana

  • How to get the layout values in F4 help from Other program ?

    Hello All,
           I have a program P1which calls other program P2 .
    When I execute P1 I have a parameter for Layout with F4.
    When I press  F4 I want the help values which are there in the lay out of the other program P2.
    For this I'm using the following code :-
    DATA  spec_layout        TYPE  disvariant.  "specific layout
    DATA  v_save             TYPE  c.           "Save mode
    DATA  gs_variant         TYPE  disvariant.  "for parameter IS_VARIANT
    DATA  gv_exit            TYPE  c.
    PARAMETERS:  p_vari  TYPE disvariant-variant.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
    *  gs_variant-report  = sy-repid.
    *  gs_variant-variant = p_vari.
      CLEAR gs_variant.
      MOVE  '/BSHP/FP_CALL_OF_PLAN' TO gs_variant-report. "Report von Original CALL_OF_PLAN
      gs_variant-variant = p_vari.
      CALL FUNCTION 'LVC_VARIANT_F4'
        EXPORTING
          is_variant = gs_variant
          i_save     = v_save
        IMPORTING
          e_exit     = gv_exit
          es_variant = spec_layout
        EXCEPTIONS
          not_found  = 1
          OTHERS     = 2.
      IF sy-subrc NE 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ELSE.
        IF gv_exit NE 'X'.
    *     set name of layout on selection screen
          p_vari    = spec_layout-variant.
        ENDIF.
      ENDIF.
    But still I'm not able to get the values.
    Can anyone help me out ?
    Regards,
    Deepu.K
    null

    This question has been asked and answered many times before.  Please read the following blog for a good start:
    /people/yohan.kariyawasan/blog/2009/03/18/ui-framework-news-f4-help
    Before posting further please do a search in this forum and also read the rules of engagement listed here:
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/home/rulesofEngagement
    I'm now locking this thread as it is a duplicate of an already answered question.
    Thank you,
    Stephen
    CRM Forum Moderator

  • I would like to find out if there is a formula to get the last value of the month.

    Post Author: Ajit Pawar
    CA Forum: Authentication
    Hi All,
    I am using BO 6.5 i would like to know is there any formula which will give last value of month in report.
    Further I would like to confirm if the formula I am to use for Max and Min is correct as:
    Minimum =Min(&#91;Q1&#93;.&#91;ValueAvg&#93; In (&#91;Q1&#93;.&#91;Parameter&#93;;&#91;Q1&#93;.&#91;Element&#93;;&#91;Q1&#93;.&#91;Date&#93;))
    Maximum = Max(&#91;Q1&#93;.&#91;ValueAvg&#93; In (&#91;Q1&#93;.&#91;Parameter&#93;;&#91;Q1&#93;.&#91;Element&#93;;&#91;Q1&#93;.&#91;Date&#93;))
    where Q1 is the query name.

    If you did not back up your iTunes library, the short answer is no, as the iPhone is designed to delete the music data when connecting to an new computer / hard drive.
    .......however there are some 3rd party softwares designed to do this, and if you seek these out, they will likely work for you. 
    Here is one I found by google searching - http://thelittleappfactory.com/irip/index_irip1.php

Maybe you are looking for

  • Purchase Order Document limit to user

    Hi All,             My requirement is to limit a user such that user should not raise any purchase orders whose document total exceeding Rs. 5000.              I need a functionality without using Approval procedures. Thankyou.

  • LMS 4.0 ANI Data Collection

    Lately my ANI Data Collection seems to be running continuously. I even backed off the schedule for UT acquisitions to no avail. I also restarted the daemon manager. I'm not sure if it's related but we made some changes on the management SVIs for a nu

  • Read LEDs of a system under test?

    Hi, I have a system (with real LEDs, i.e. not inside labview) that that can have the following color states for LEDs: Red, green, yellow and none. it should also be possible to detect a blink frequency up to 2 Hz. Is there any equimpent for this? I k

  • Macbook Pro bluetooth is not available

    Recently my MacBook Pro bluetooth became not available and I cant do any thing about it. Can anyone help me in this case ?

  • VAT: RFUMSV00 bacth deleted

    Hi, one of my user launched the VAT program RFUMSV00 (S_ALR_87012357) and deleted the batch because new postings were on-going that will change the VAT amounts. After that he tried to relaunch RFUMSV00 but he has only be able to generate a bacth for