Crosstab Query re Grouping Data into Value Ranges

Hi
I am trying to analyse some data in a Crosstab & have a query re grouping.
The data contains sales transaction info such as selling price, quantity etc. I would like to create a grouping in the Crosstab based on a sale price range (eg £0 - £10, £10 - £20 etc) so that I can show the total quantity sold in each price range.
To date my method has been to create a formula with Select Case which identifies each transaction into a price range. I would then use this formula in my Crosstab. The main issue with this method is that there will be a large number of Cases & the possibility this will need to be added to / modified going forward.
Whilst I think this will work I am hoping there is better method to follow?
Thanks
Jon

Hi Jamie,
Thank you for your help.
I'm looking to group in increments of 10 so it looks like the Floor function will do the trick, thank you.
I'll probably use an If statement to do a "block" of prices at either end of the scale (ie < 100 then 100, > 1000 then 1000+ else Floor ({Sales Field},10). Hopefully this way I'll reduce the overall no of rows.
Thanks again for your help.
Jon

Similar Messages

  • CAML query to select data in specfic range

    CAML query to select data in specfic range.
    I have a list-A and it has a column 'Col1' which has thousands records, I want to fetch data in a specific range as:
    select Col1,Col2 from list-A where Col1 > 100 and Col1 < 600

    Hi,
    The following code with the CAML query for your reference:
    using (SPSite site = new SPSite("http://spsite/"))
    using (SPWeb web = site.OpenWeb())
    string sQuery = @"<where><and><gt><fieldref name='Col1' /><value type='number'>100</value></gt><lt><fieldref name='Col1' /><value type='number'> 600 </value></lt></and></where>";
    string sViewFields = @"<fieldref name='Col1' /><fieldref name='Col2' />";
    string sViewAttrs = @"Scope='Recursive'";
    var oQuery = new SPQuery();
    oQuery.Query = sQuery;
    oQuery.ViewFields = sViewFields;
    oQuery.ViewAttributes = sViewAttrs;
    SPList oList = web.Lists["ListName"];
    SPListItemCollection collListItems = oList.GetItems(oQuery);
    foreach (SPListItem oListItem in collListItems)
    More information about the CAML:
    http://msdn.microsoft.com/en-us/library/office/ms467521(v=office.15).aspx
    http://msdn.microsoft.com/en-us/library/office/ms462365(v=office.15).aspx
    Here is a tool will help you to build and test SharePoint CAML Queries:
    https://spcamlqueryhelper.codeplex.com/
    Best Regards
    Dennis Guo
    TechNet Community Support

  • SQL query to group data by Code and dates

    Hi There,
    I have the following table structure
    col1 col2 col3
    code1 21-jan-2012 tested
    code1 20-jan-2012 tested
    code1 01-jun-2012 tested
    code2 01-jun-2012 tested
    code3 04-jun-2012 tested
    so on
    The output should be some thing like
    code Week1 week2 week 3 week4 week5 till about last 14 weeks from the date we are running
    code1 1 0 0 0 0
    code2 1 0 0 0 0
    code 3 0 1 0 0 0
    where 1, 0 is actually the counts and not sum and the week in this case, should have maybe been since we are in the second week it should have been
    code .....................week3 may week4 may week1 jun week2june
    Was looking for suggestions on how to get this done.
    I am assuming this would require some sort of a pivot query?
    Thanks,
    Sun

    Hi, Sun,
    sun1977 wrote:
    Thanks EKH,
    Yes, in lines of the output of this query. Is it possible to,
    1. In the query, if condition is met, the it simply displays 1 else 0. Basically, we need to get the count of the number of the codes in that week. So if code 1 happened 5 times, it should show 5.Sure; use COUNT instead of MAX.
    2. Provide the output between two dates. Lets say, I have to do it for the last 14 weeks from sysdate. Then will the logic of week1 = 1 work?Use date arithmetic to get the number of days between the starting date and col2, then divide by 7 to get the number of weeks. Use that number instead of the value returned by TO_CHAR.
    3. any suggestions if the counts have to be changed to percentages. How can we have the percentage value showingYou can do that. Exactly how depends on exactly what you want. It may involve using the analytic RATIO_TO_REPORT function in a sub-query. Post the exact results you want from the sample data that Ekh posted (or new sample data that you post), and explain how you get those results from that data.
    4. Would we also be able to add a date bind value. Lets say, if the user selects start date as may, 1st, 2012 and end date as jun5th. It sort of shows the same data but in weekly format for the weeks between the period selected?Sure, just use those values in a WHERE clause. The output needs to have a fixed number of columns, however. Say that number is 14. You can give a range that only covers 5 weeks, but the output will have 9 0's at the end of every row. You can give a range that covers 15 or more weeks, but the weeks after 14 will not be shown. To get around that requires dynamic SQL (if you want each week in a real column) or string aggregation. See {message:id=3527823}
    Point 3 is different from point 1 as in, the first one would be maybe using your logic but hardcoding for 14 weeks. Point three would be a little more dynamic.
    Thanks for your time.
    Sun
    Edited by: sun1977 on Jun 7, 2012 2:28 AM
    EXEC  :start_dt_txt := '01-May-2012';
    EXEC  :end_dt_txt   := '05-Jun-2012';
    WITH  got_week_num  AS
         SELECT  col1, col2
         ,     1 + FLOOR ( (col2 - TO_DATE (:start_dt_txt, 'DD-Mon-YYYY'))
                         / 7
                     )     AS week_num
         FROM    t
         WHERE     col2     >= TO_DATE (:start_dt_txt, ':DD-Mon-YYYY')
         AND     col2     <  TO_DATE (:end_dt_txt,   ':DD-Mon-YYYY') + 1
    SELECT       col1
    ,       COUNT (CASE WHEN week_num =  1 THEN 1 END)     AS week_1
    ,       COUNT (CASE WHEN week_num =  2 THEN 1 END)     AS week_2
    ,       COUNT (CASE WHEN week_num =  3 THEN 1 END)     AS week_3
    ,       COUNT (CASE WHEN week_num =  4 THEN 1 END)     AS week_4
    ,       COUNT (CASE WHEN week_num =  5 THEN 1 END)     AS week_5
    ,       COUNT (CASE WHEN week_num =  6 THEN 1 END)     AS week_6
    ,       COUNT (CASE WHEN week_num = 14 THEN 1 END)     AS week_14
    FROM       got_week_num
    GROUP BY  col1
    ORDER BY  col1
    ;Edited by: Frank Kulash on Jun 7, 2012 5:53 AM

  • Query to group dates based on days of week

    Hi,
    I have a table containing the following format:
    Create table testtable(dates date, day_identifier number);
    The day_identifier column data contains the corresponding dates columns' day of week equivalent i.e.
    to_char(dates, 'd')
    The table contains following sample data:
    Dates
    Day_identifier
    01-Oct-2013
    3
    02-Oct-2013
    4
    04-Oct-2013
    6
    06-Oct-2013
    1
    08-Oct-2013
    3
    09-Oct-2013
    4
    11-Oct-2013
    6
    18-Oct-2013
    6
    21-Oct-2013
    2
    23-Oct-2013
    4
    I am looking for a query that will group the above data based on the day_identifier column data into the following format:
    01-Oct-2013 11-Oct-2013 1346
    18-Oct-2013 23-Oct-2013 246
    The above data if expanded i.e.
    all dates between 01-Oct-2013 and 11-Oct-2013 and having day of week value in 1,3,4,6
    and
    all dates between 18-Oct-2013 and 23-Oct-2013 and having day of week value in 2,4,6
    will give me the above table's resultset.
    Please help me in resolving the issue.
    Thanks.

    with
    groups as
    (select 'one' grp,
            to_date('01-Oct-2013','dd-Mon-yyyy') low_date,
            to_date('06-Oct-2013','dd-Mon-yyyy') high_date,
            '3,5,7' day_identifiers from dual union all
    select 'two',to_date('10-Oct-2013','dd-Mon-yyyy'),to_date('16-Oct-2013','dd-Mon-yyyy'),'1,2' from dual union all
    select 'six',to_date('20-Oct-2013','dd-Mon-yyyy'),to_date('26-Oct-2013','dd-Mon-yyyy'),'4,5,6' from dual
    dates as
    (select trunc(sysdate,'mm') + level - 1 the_date,to_char(trunc(sysdate,'mm') - level - 1,'d') day_identifier
       from dual
    connect by level <= to_number(to_char(last_day(sysdate),'dd'))
    select d.the_date,d.day_identifier,g.grp,g.low_date,g.high_date,g.day_identifiers
      from dates d,
           groups g
    where d.the_date between g.low_date(+) and g.high_date(+)
       and instr(','||g.day_identifiers(+)||',',','||d.day_identifier||',') > 0
    THE_DATE
    DAY_IDENTIFIER
    GRP
    LOW_DATE
    HIGH_DATE
    DAY_IDENTIFIERS
    10/01/2013
    1
    10/02/2013
    7
    one
    10/01/2013
    10/06/2013
    3,5,7
    10/03/2013
    6
    10/04/2013
    5
    one
    10/01/2013
    10/06/2013
    3,5,7
    10/05/2013
    4
    10/06/2013
    3
    one
    10/01/2013
    10/06/2013
    3,5,7
    10/07/2013
    2
    10/08/2013
    1
    10/09/2013
    7
    10/10/2013
    6
    10/11/2013
    5
    10/12/2013
    4
    10/13/2013
    3
    10/14/2013
    2
    two
    10/10/2013
    10/16/2013
    1,2
    10/15/2013
    1
    two
    10/10/2013
    10/16/2013
    1,2
    10/16/2013
    7
    10/17/2013
    6
    10/18/2013
    5
    10/19/2013
    4
    10/20/2013
    3
    10/21/2013
    2
    10/22/2013
    1
    10/23/2013
    7
    10/24/2013
    6
    six
    10/20/2013
    10/26/2013
    4,5,6
    10/25/2013
    5
    six
    10/20/2013
    10/26/2013
    4,5,6
    10/26/2013
    4
    six
    10/20/2013
    10/26/2013
    4,5,6
    10/27/2013
    3
    10/28/2013
    2
    10/29/2013
    1
    10/30/2013
    7
    10/31/2013
    6
    Regards
    Etbin

  • Query for inserting data into table and incrementing the PK.. pls help

    I have one table dd_prohibited_country. prohibit_country_key is the primary key column.
    I have to insert data into dd_prohibited_country based on records already present.
    The scenario I should follow is:
    For Level_id 'EA' and prohibited_level_id 'EA' I should retreive the
    max(prohibit_country_key) and starting from the maximum number again I have to insert them
    into dd_prohibited_country. While inserting I have to increment the prohibit_country_key and
    shall replace the values of level_id and prohibited_level_id.
    (If 'EA' occurs, I have to replace with 'EUR')
    For Instance,
    If there are 15 records in dd_prohibited_country with Level_id 'EA' and prohibited_level_id 'EA', then
    I have to insert these 15 records starting with prohibit_country_key 16 (Afetr 15 I should start inserting with number 16)
    I have written the following query for this:
    insert into dd_prohibited_country
    select     
         a.pkey,
         b.levelid,
         b.ieflag,
         b.plevelid
    from
         (select
              max(prohibit_country_key) pkey
         from
              dd_prohibited_country) a,
         (select
    prohibit_country_key pkey,
              replace(level_id,'EA','EUR') levelid,
              level_id_flg as ieflag,
              replace(prohibited_level_id,'EA','EUR') plevelid
         from
              dd_prohibited_country
         where
              level_id = 'EA' or prohibited_level_id = 'EA') b
    My problem here is, I am always getting a.pkey as 15, because I am not incrementing it.
    I tried incrementing it also, but I am unable to acheive it.
    Can anyone please hepl me in writing this query.
    Thanks in advance
    Regards
    Raghu

    Because you are not incrementing your pkey. Try like this.
    insert
       into dd_prohibited_country
    select a.pkey+b.pkey,
         b.levelid,
         b.ieflag,
         b.plevelid
       from (select     max(prohibit_country_key) pkey
            from dd_prohibited_country) a,
         (select     row_number() over (order by prohibit_country_key)  pkey,
              replace(level_id,'EA','EUR') levelid,
              level_id_flg as ieflag,
              replace(prohibited_level_id,'EA','EUR') plevelid
            from     dd_prohibited_country
           where level_id = 'EA' or prohibited_level_id = 'EA') bNote: If you are in multiple user environment you can get into trouble for incrementing your PKey like this.

  • Query Problem - Group data by time

    I have statistic data that record by time such as
    Time Data
    19-MAR-06 10:01 100
    19-MAR-06 10:02 100
    19-MAR-06 10:03 100
    19-MAR-06 10:04 100
    19-MAR-06 10:05 100
    19-MAR-06 10:06 100
    I would like to group data every five minute start from 00:00 to 23:59 for example the result should be
    Time Sum(Data)
    19-MAR-06 00:00 0
    19-MAR-06 00:05 0
    19-MAR-06 10:00 400
    19-MAR-06 10:05 200
    Any suggest?

    SELECT times.all_time, NVL(real.sum,0)
    FROM
       (SELECT  mintim + (level * (1/12/24)) - 1/12/24 AS all_time
        FROM    ( SELECT trunc(MIN(time),'DD') mintim
                       , trunc(MAX(time),'DD') + 1 maxtim
                  FROM   testtab
        CONNECT BY mintim + (level * (1/12/24)) - 1/12/24 <= maxtim
        ) times,
       (SELECT TRUNC(time,'HH24') +
              (TRUNC(TO_CHAR(time,'MI')/5)*5)/24/60 real_time, sum(data) sum 
        FROM testtab                      
        GROUP BY  TRUNC(time,'HH24') + (TRUNC(TO_CHAR(time,'MI')/5)*5)/24/60) real
    WHERE times.all_time = real.real_time(+)  
    ORDER BY times.all_time
    19-Mrz-2006     0
    19-Mrz-2006 0:05:00     0
    19-Mrz-2006 0:10:00     0
    19-Mrz-2006 0:15:00     0
    19-Mrz-2006 9:45:00     0
    19-Mrz-2006 9:50:00     0
    19-Mrz-2006 9:55:00     0
    19-Mrz-2006 10:00:00     400
    19-Mrz-2006 10:05:00     200
    19-Mrz-2006 10:10:00     0
    19-Mrz-2006 23:45:00     0
    19-Mrz-2006 23:50:00     0
    19-Mrz-2006 23:55:00     0
    20-Mrz-2006     0

  • Query on uploading data into infotype

    Hi,
    I am in search of a method to upload data into infotypes  IT0001,HRP1001.
    I have serached and found we can do it using BDC,LSMW and through Hr_INOFYTPE_OPERATION--fm.
    But in my flat file am having pernr ,begda,endda and supervisor..
    Some of my searches said if i had a pernr in flat file its impossible to do with HR_INFOTYPE_OPERATION.
    CAN ANYONE PLS SUGGEST ME THE BEST WAY TO DO?
    Thanks

    Hi Salini
    Using BDC or LSMW might lead to some inconsistencies.
    Uploading of various infotype data depends upon its volume.
    There is a FM: HR_MAINTAIN_MASTERDATA through which you can upload the data. But this does for one record at a time. So the performance gets affected at times. Before calling this FM each time, clear the buffer using the FM:  'HR_PSBUFFER_INITIALIZE'. This will be of great help.
    Incase you want to upload all your data at once, you can use BAPI_HRMASTER_SAVE_REPL_MULT.
    Let me know incase you need any help in any of these.
    Regards
    Harsh

  • How to query a reporting data source using ranges?

    HI guys,
    I was looking at the BPM Reporting API available and more specifically the way one can query and search for data, stored in a reporting Data Source.
    I can see that there are methods in the API, allowing for a search by concrete field name and value, triggering data with exact or partial match of the specified value (query() and search() methods of ReportingDataSourceManager interface).
    However, we need to query using ranges of numbers or dates. Can someone advice how this can be done without creating a method of our own processing the whole data set?
    For example, how I can retrieve all data stored since yesterday? am I missing something in the BPM Reporting API? Any suggestions will be much appreciated.
    Kind Regards,
    Mariya Stancheva

    i think you have to do it by your own code.

  • Group based on value range and order with in group

    Hi All,
    I have a scenario like to group record set based on a value set.
    Example.
    Table data_table has 10 columns of which one column grouping_col can have value from 10 - 100
    i have to retreive a report with multiple order by clause with a precondition that
    record having grouping_col having 10-50 should be processed first then,
    record having grouping_col having 50-60 should be processed next and then so on untill 100.
    Is there a way to do this without union funcitonality.

    Please read the SQL and PL/SQL FAQ:
    SQL and PL/SQL FAQ
    especially the second question regarding how to post a question on the forums.

  • Grouping data sent to servlet

    I have an applet servlet pair and I'm having trouble grouping the data coming in from various clients. Let's say there are five clients connected to the servlet on individual threads. The data from clients A, B, and C need to be grouped together, while the data from clients D and E are grouped together. In reality the exact groupings are determined at runtime by the users, but for out example let's say this is how it has worked out. My idea was to create for each group an instance of some class, let's call it simply "clientGroup" on the server that holds and processes the data for each client group. So data coming in from clients A, B or C would be placed into clientGroup1, while any data that came in from D and E would be placed in clientGroup2. To do this it seems that I need to send some sort of metadata with the actual data I'm sending from the applet to the servlet that instructs the servlet "put this data into clientGroup1" or whichever. Reflexivity seems only to be able to create new objects of class clientGroup, not reference and edit existing instances like clientGroup1 or clientGroup2. So what can I pass along with my data to instruct the servlet in which class instance to put the incoming data?

    At least you should be able to identify clients to check to which group they belong. The client should for example be logged in and its group ID should already be known at the server side. Or let the client pass a specific parameter indicating the group ID. If you can do that, then it is just easy. Declare an applicationwide Map somewhere where you use the group ID as key and the group data as value.

  • Value ranges

    Hi,
           Can anyone tell me what is the use of value ranges. and Can anyoen plz give me example how to give data in value ranges table which is presnt in domain.
    thanking u all.
    regards,
    kavita

    hi,
    A domain defines a value range. A domain is assigned to a data element. All table fields or structure components that use this data element then have the value range defined by the domain.
    <b>The value range of a domain is defined by specifying a data type and length (and number of decimal places for numeric data types).</b>
    The value range of a domain can be restricted by defining fixed values. If all the fields or components that refer to the domain should be checked against a certain table, this table can be defined as the value table of the domain.
    regards,
    ashokreddy

  • SSRS Bar Chart grouping date series into Months, setting scaler start and end ranges

    I've been trying to solve this issue for a few days now without writing a sql script to create a "blank" for all of missing data points so that I get a bar for each month.  I have date series (by day) data points grouped by two items
    that creates a set of bar charts.  EG:  one chart per product in the tablix detail grouped to site level.
    My issue is I would like the start and end of the charts to be the same for all charts and the only way I get it to work is with a chart that continues to show each date on the chart. 
    EG:
    I have the graph start and end points set and scaling by month as I would like but each bar is a day instead of aggregating to a month level.   My issue I hope to find a workaround for is if I go to Category Groups and define the grouping
    to group with a year and month function the series is no longer treated as date data and I cannot control scaling.  It works fine if all months have activity, but I can't figure out how to always have all charts start at "May 2012" in this example. 
    The only start and end point that I've been able to get to work once doing this are integer based, eg normal start would be 1 for each graph, but 1 doesn't equate to the same month from chart to chart.
    I hope SSRS can provide the solution.  I do know I can write a query that creates a ZERO value for each month/product/site but I don't want to leave the client with a query like that to support.
    -cybertosis

    Hi cybertosis,
    If I understand correctly, you want to display all month category label in the X-Axis. You have configure the Scalar Axis, however, it cannot display the requirement format.
    In your case, if we want the specific data format, we can configure Number property to set the corresponding Category data format. Please refer to the following steps:
    Right click the X-Axis, select Horizontal Axis Properties.
    Click Number in the left pane. Click Date option in the Category dialog box.
    Then, select Jan 2000 option.
    Please refer to the following screenshot below:
    If there are any misunderstanding, please feel free to let me know.
    Regards,
    Alisa Tang
    If you have any feedback on our support, please click
    here.
    Alisa Tang
    TechNet Community Support

  • Crosstab Query for Remaining Revenue (Count, If, Date Between )

    Hi all, hope you had a great new year.
    I am wanting to create a crosstab query for my Projects which shows ProjectID in the row headers and Time Periods split into months quarter or year as the Column Headers using the [DateAgreed] from the Session table. 
    I have created crosstabs which show revenue from sessions and count of sessions with different time periods but i am trying to make it so that it counts only completed sessions from before the column date, so that i can then multiply by the [SessionCost].
    Any ideas guys?
    Here's what i have been working with;
    TRANSFORM Sum(([tblSession]![SessionCompleted]*[tblProject]![SessionCost])) AS Revenue
    SELECT tblProject.ProjectID, tblCompany.CompanyName
    FROM (tblSession INNER JOIN tblCompany ON tblSession.CompanyID = tblCompany.CompanyID) INNER JOIN ((tblProject INNER JOIN tblProjectMetrics ON tblProject.ProjectID = tblProjectMetrics.ProjectID) INNER JOIN qryProjectStatus ON tblProject.ProjectID = qryProjectStatus.ProjectID)
    ON (tblProject.ProjectID = tblSession.ProjectID) AND (tblCompany.CompanyID = tblProject.CompanyID)
    GROUP BY tblProject.ProjectID, tblCompany.CompanyName, tblProject.Total
    PIVOT Format([DateAgreed],"yyyy-mm");
    Thanks :)

    Hi Gord0oo,
    You could concatenates the data as a result and show in a cell.
    TRANSFORM Sum([tblProject]![SessionCost])) & ";" & Sum([tblSession]![SessionCompleted]) AS Revenue
    Regards
    Starain
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Split range of dates into rows

    Hi,
    I have a table which basically has an account id and two dates (from and to). Sample data:
    Account ID       Balance Amt        Valid From           Valid To
    100000524       104.32               29/07/2010         05/08/2010
    100000524       104.32               03/11/2010         25/12/2010
    100000365       104.32               29/07/2010         05/08/2010What I currently do is that I loop on each record (per Account and Order by valid From). Then each row I processed into this query to split it into multiple rows - final result should be that for each of the month on the range I'll get the last day of it. See below for results:
    select account_id, balance_amt,
           last_day(add_months(valid_from_dttm, level - 1)) as valid_to_dttm
    FROM d
    CONNECT BY LEVEL <= ( SELECT TRUNC( MONTHS_BETWEEN( LAST_DAY(valid_to_dttm),
                                                        TRUNC(valid_from_dttm, 'Month'))
                                      ) + 1 lvl
                          FROM dual )
    Account ID       Balance Amt        Valid To
    100000524       104.32               31/07/2010        
    100000524       104.32               31/08/2010 It's pretty slow since I do it row by row. Is there any other way (faster) to do this? Thanks.
    I forgot to say is that one of the trouble I'm getting here is that the dates are overlapping e.g.:
    Account ID       Balance Amt        Valid From           Valid To
    100000524       104.32               29/07/2010         05/08/2010
    100000524       65                     05/08/2010         25/10/2010
    100000524       10                     25/10/2010         20/12/2010So in this case the August month should only be displayed once with the value of 65 since it's the "latest".
    Edited by: mortonmorton on Apr 25, 2011 2:14 AM
    Edited by: mortonmorton on Apr 25, 2011 2:19 AM

    Hi Guys,
    I've tried both your queries and it's the same issue I'm getting which is duplicate rows of the month end dates. So using the model clause above (just tweaking the data):
    with d as
    ( select 100000524  account_id, 104.32 balance_amt, to_date('29/07/2010','DD/MM/YYYY') valid_from_dttm,  to_date('05/09/2010','DD/MM/YYYY') valid_to_dttm from dual union
      select 100000524, 16.32,  to_date('05/09/2010','DD/MM/YYYY'), to_date('25/12/2010','DD/MM/YYYY') from dual union
      select 100000365 , 104.32,  to_date(' 29/07/2010 ','DD/MM/YYYY'), to_date('05/08/2010','DD/MM/YYYY') from dual
    select account_id, balance_amt,  last_day(add_months(valid_to_dttm,-1)) new_valid_to_dttm
    from d
    model
    partition by (account_id, balance_amt, valid_from_dttm, valid_to_dttm vtd)
    dimension by (0 d)
    measures (valid_to_dttm,  valid_from_dttm vfd )
    rules
    valid_to_dttm[for d  from 1 to
                          MONTHS_BETWEEN (LAST_DAY (valid_to_dttm[0]), TRUNC (vfd[0], 'Month') )
                          increment 1] =   add_months(valid_to_dttm[cv()-1],1)
    order by account_id, valid_to_dttm
    ACCOUNT_ID     BALANCE_AMT     NEW_VALID_TO_DTTM
    100000365                     55.63     31/07/2010
    100000365      55.63     31/08/2010
    100000524      104.32     31/08/2010
    100000524      104.32     30/09/2010
    100000524      104.32     31/10/2010
    100000524      16.32     30/11/2010
    100000524      16.32     31/12/2010
    100000524      16.32     31/01/2011
    100000524      16.32     28/02/2011But expected output should be:
    ACCOUNT_ID     BALANCE_AMT     NEW_VALID_TO_DTTM
    100000524                104.32     31/07/2010
    100000524      104.32     31/08/2010
    100000524      16.32     30/09/2010
    100000524      16.32     31/10/2010
    100000524      16.32     30/11/2010
    100000524      16.32     31/12/2010
    100000365                55.63     31/07/2010
    100000365      55.63     31/08/2010One thing to note here is the September month which had a final value of 16.32 - it overlapped the previous entry of 104.32.

  • How to insert date into ms access database using sql query in servlet

    sir all thing is working well now only tell me how we can insert date into ms access database which is input by user .
    insert into db2(bookname,studentname,date) values('"+bname+"','"+sname+"',date_format)";{code}
    or either the system date is inserted with query .
      plz help me
    thanx                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    bhavishya wrote:
    sir all thing is working well now only tell me how we can insert date into ms access database which is input by user .
    insert into db2(bookname,studentname,date) values('"+bname+"','"+sname+"',date_format)";{code}
    or either the system date is inserted with query .
    plz help me
    thanxAnd that SQL statement is another reason to use PreparedStatement. I assume bname and sname are input from some form? Well, if that's the case, simply inserting them into SQL by simple String concatenation is just begging for all sorts of problems. What if there is an apostrophe in the entry? Broken Statement. Worse, it's a wide open invitation to an SQL Injection attack.

Maybe you are looking for

  • Help with CS 6 on a second computer

    My daughter has Photoshop CS 6 installed on her 64 bit Windows 7 Pro computer.  She now has a new computer (also 64 bit Windows 7 Pro)  and would like to get CS 6 on it too.  I have been led to believe that she can have the program on two computers a

  • Problem with my iMac 10.1 (21.5")!

    Please! Help me! I have a problem with my iMac 10.1 (21.5")! The coolers are spinning very quick! I think what it is problem with SMC. I have already reset the SMC, check the temperature sensor, reset the PRAM and NVRAM, but it is not help! What you

  • How to define alt text for an anchored frame in FrameMaker 11?

    What is the procedure in FrameMaker 11 to include alt text for anchored frames? We need to produce tagged PDF output that is accessibility compliant; this output must include alt text for each image in the document that a screen reader can read out.

  • Reg. object in an internal table,

    data : begin of itab occurs 0,   var1 LIKE sy-index,   var2(20),   obj TYPE REF TO zclass, END OF itab. Zclass has a public attribute, A. what't the way for filling & reading this type of itab, I want to put just 4 records in this itab. For any clari

  • Library went from 5k songs to 30 after upgrade to iTunes7. Help.

    Upgraded to iTunes 7, and my library lost all songs except those added since 7/23/06. I lost about 5,000 songs. They're all still in my iPod though. Any idea what happened? video 60gb Windows XP Pro