SQL - sorting and grouping.

Hello

I have question posted for two days, but no help of body...
This link

You place your order by comparing - SQL Experts pls help

concerning

Published by: Ayham on October 8, 2012 02:54

If I am clear...

SQL> with t as
  2  (select percentage,loc1,loc2,sum(case when percentage = 0 then 1
  3                     when loc1 in (l1,l2) then 0
  4                 when loc2 in (l1,l2) then 0
  5                 when l1 is null and l2 is null then 0
  6                 else 1
  7            end) over(order by rn) sm
  8  from (     select id,location,percentage,
  9                     regexp_substr(location,'\d+',1,1) LOC1,
 10                     regexp_substr(location,'\d+',1,2)  LOC2,
 11                     lag(regexp_substr(location,'\d+',1,1))
 12                     over(order by percentage desc) l1,
 13                     lag(regexp_substr(location,'\d+',1,2))
 14                     over(order by percentage desc) l2,
 15             row_number() over(order by percentage desc) rn
 16     from temp_value
 17     order by percentage desc
 18       )
 19  )
 20  select loc,min(sm)+1 grp
 21    from(
 22      select loc,rownum rn,sm
 23      from(
 24      select percentage,decode(rn,1,loc1,loc2) loc,sm
 25      from t a,
 26           (select 1 rn from dual union all
 27            select 2 from dual ) b
 28      order by percentage desc,decode(rn,1,loc1,loc2) asc
 29     )
 30  )
 31   group by loc
 32  order by min(sm),min(rn);

LOC                         GRP
-------------------- ----------
4                             1
5                             1
2                             1
1                             1
6                             2
3                             3

6 rows selected.

Tags: Database

Similar Questions

  • Sorting and grouping - two months in this query

    Hi all

    Thanks a lot for JAC

    I am doing a project for the construction company, I faced this problem by grouping points according to the relationship between these points the
    Relationship is from 1 to 100. If the point between what means there is relationship between these points has come.

    resolve this question already, but the results does not correct when the table contains more data.

    SQL - sorting and grouping.
    Jac and thanks a lot to him.

    This example for more details

    for example, I have these points
    id   location         percentage   comments 
    1     loc 1,2          20%                that mean point  1 and 2 close to each other by 20%
    2     loc 1,3          40%              that mean point 1 and 3 close to each other byy 40%
    3     Loc 8,6          25%               that mean point 8 and 6 close to each other by 25% 
    4     Loc  6,10        20%
    5     LOC 11,10        10 %
    6     LOC 15,14         0%
    In addition, we can see the relationship between these points as follows
    -points 1,2,3 in a group why because close 1.2 and 1.3 a relationship which means 1.3 also hid the relationship.
    -Points 6,8,10,11 in the second group there are the relationships between them.
    - but no relationship between 1, 2 or 3 with any point of 6,8,9,10,11
    -as well as no relationship between 15, 14, which means 14 in the third group and 15 in the fourth group.


    Whati need?

    to group the points that growing a relationship according to the percentage value


    The most important part is to group the points. For EXAMPLE, the query below, the gropuing is not correct.

    I have the following table with data
    drop table temp_value; 
    create table temp_value(id number(10),location varchar2(20), percentage number(9)); 
     
     
    insert into temp_value values  (1,'LOC 1,2',10); 
    insert into  temp_value values (2,'LOC 1,3',0); 
    insert into  temp_value values (3,'LOC 1,4',0); 
    insert into  temp_value values (4,'LOC 1,5',0); 
    insert into  temp_value values (5,'LOC 1,6',0); 
    insert into  temp_value values (6,'LOC 2,3',0); 
    insert into  temp_value  values(7,'LOC 2,4',0); 
    insert into  temp_value values (8,'LOC 2,5',30); 
    insert into  temp_value values (9,'LOC 2,6',0); 
    insert into  temp_value values (10,'LOC 3,4',0); 
    insert into  temp_value values (11,'LOC 3,5',0); 
    insert into  temp_value values (12,'LOC 4,5',40); 
    insert into  temp_value values (13,'LOC 4,6',0); 
    insert into  temp_value values (14,'LOC 6,7',40);
    insert into  temp_value values (15,'LOC 7,2',0);
    insert into  temp_value values (16,'LOC 8,2',60);
    insert into  temp_value values (17,'LOC 8,3',0);
    insert into  temp_value values (18,'LOC 3,1',0);
    insert into  temp_value values (19,'LOC 9,6',30);
    insert into  temp_value values (20,'LOC 11,2',0);
    insert into  temp_value values (22,'LOC 12,3',10);
    insert into  temp_value values (23,'LOC 19,3',0);
    insert into  temp_value values (24,'LOC 17,3',0);
    insert into  temp_value values (24,'LOC 20,3',0);
    When I used this query, the results is not correct

     with t as
        (select percentage,loc1,loc2,sum(case when percentage = 0 then 1
                           when loc1 in (l1,l2) then 0
                       when loc2 in (l1,l2) then 0
                       when l1 is null and l2 is null then 0
                       else 1
                  end) over(order by rn) sm
        from (     select id,location,percentage,
                           regexp_substr(location,'\d+',1,1) LOC1,
                          regexp_substr(location,'\d+',1,2)  LOC2,
                         lag(regexp_substr(location,'\d+',1,1))
                          over(order by percentage desc) l1,
                          lag(regexp_substr(location,'\d+',1,2))
                          over(order by percentage desc) l2,
                  row_number() over(order by percentage desc) rn
          from temp_value
          order by percentage desc
            )
      )
       select loc,min(sm)+1 grp
         from(
           select loc,rownum rn,sm
           from(
           select percentage,decode(rn,1,loc1,loc2) loc,sm
           from t a,
                (select 1 rn from dual union all
                 select 2 from dual ) b
           order by percentage desc,decode(rn,1,loc1,loc2) asc
          )
       )
        group by loc
       order by min(sm),min(rn);
    results


    SQL > /.
    LOC                         GRP
    -------------------- ----------
    2                             1
    8                             1
    6                             2
    7                             2
    4                             3
    5                             3
    9                             4
    1                             5
    12                            6
    3                             6
    11                           13
    
    LOC                         GRP
    -------------------- ----------
    19                           14
    17                           15
    20                           22
    
    14 rows selected.
    SQL >


    but the just is
    Location        group No
    2                  1
    8                  1
    4                  1
    5                  1
    1                  1
    6                  2
    7                  2
    9                  2
    12                 3
    3                  3
    19                 4
    17                 5
    20                 6
    Thanks in advance.

    Published by: Isabelle on November 30, 2012 03:07

    OK, I thought an it once again and found out how to include with any such percentage points.
    In your example expected output you missed the 11 that's why we got 7 groups now.
    The order of the Group 2 and 3 is ambiguous, because the highest percentage of these groups is the same.

    with connects as (
    select distinct
     loc1
    ,loc2
    ,connect_by_root(loc1) grp
    ,percentage per
    from
    temp_value
    --start with
    --percentage != 0
    connect by nocycle
    (prior loc2 = loc1
    or
    prior loc1 = loc2
    or
    prior loc1 = loc1
    or
    prior loc2 = loc2)
    and
    percentage != 0
    and
    prior percentage != 0
    )
    
    select
     loc
    ,dense_rank() over (order by decode(per,0,1,0), grp) grp
    from (
    select
     loc
    ,max(grp) keep (dense_rank first order by per desc, grp) grp
    ,max(per) keep (dense_rank last order by per nulls first) per
    from (
    select
     loc1 loc
    ,grp
    ,per
    from connects
    union
    select
     loc2
    ,grp
    ,per
    from connects
    )
    group by
    loc )
    order by 2,per desc,1
    
    LOC     GRP
    2     1
    8     1
    4     1
    5     1
    1     1
    12     2
    3     2
    6     3
    7     3
    9     3
    11     4
    17     5
    19     6
    20     7
    

    Think we are done now ;-)
    Edited by: chris227 at 30.11.2012 16:46

    Edited by: chris227 at 30.11.2012 17:12
    order corrected

    Edited by: chris227 at 30.11.2012 17:15
    simplification, no need to rank in linking subquery

    Edited by: chris227 at 30.11.2012 17:26

  • Sorting and grouping and Sub total

    Hello

    I'm looking for some generic advice here, not necessarily a specific technical recommendation.

    We have a requirement for about 15 reports/forms. The reports would be the same layout using the same sets of data, with the exception that they be sorted, grouped and Sub totalled differently.

    Use Adobe Livecycle, can you design a form and then control the behavior of sorting, grouping and Sub totaling somewhat (perhaps via the parameters passed to its interface)? We do not need to allow a user on these differences control.

    I know that something like this is pretty simple in tools such as Crystal Reports, but is possible and practical by using Adobe Livecycle? We probably want to avoid a solution that uses Javascript excessively complex and plentiful.

    We try to use Adobe for something, so it's not really meant?

    Thank you!

    You can render PDF forms during execution using XML as input. If you want to avoid the JavaScript code in the form of coding, you can do all the calculations before generating the XML file. In this scenario, I assume that you have the server software to view the PDF with the dynamic XML data during execution.

    Another option could be written the Java Script in the case of calculated fields to sort / group / total values. Since all your reports use the same provision, it is not so difficult to write code. Propably if you check the PurchaseOrder.xdp form that comes with your samples as well as the installation Designer do you a basic idea on how to calculate the values that you add more lines to the shape.

    If you still have questions, you can always contact me or the team on this forum.

    Thank you

    Srini

  • DISPLAY the Menu SORT BY & GROUP BY in WINDOWS 7 ULTIMATE

    I am interested in learning all about the different boxes in sort it by and Group dialog boxes view - sort in view-group of Windows 7 Ultimate help could have details, but help text fonts are 6-8 or 9-why only officials at Microsoft Corp. know

    I am looking for more information about the dialog boxes for Fort - more Group By - more

    Please consider adding personalization of Windows themes

    After you change the Sort by or Group by folder view settings in a library, you can restore the library in it's default Sort by or Group by folder view by clicking on the revamp by drop-down list on the toolbar (top-right) and clicking Cancel changes.

    If Undo changes don't is not on the list, the library is already set to be seen by its default view Sort by or Group by folder.

    EXAMPLE: "group by" and "sort by" in Windows Explorer
    NOTE: These screenshots, use the column name to "group by" and "sort by". What you see in your window will also depend on what you have the model file and set as .

    OPTION ONE

    Change "sort by" and "group by" view by using the View Menu

    1. open the Windows Explorer folder or library window you want to change the size of icons in the view.

    2 click themenu bar displayitem and select options that arrangement either Sort By or Group by , then select a columnname and ascending or descending for how you want the window arranged by. (See screenshots below)
    NOTE: The names of columns in the view menu bar depend on what you have the model file fixed. You can also click on more to add several options of name of column.

    SECOND OPTION

    Change "sort by" and "group by" view by using the column headers

    Note
    The sort and Group at the top and the option of the stack by down are no longer available in the final Windows 7 RTM. Please their contempt in the screenshots.

    1. open the Windows Explorer folder or library window you want to change the size of icons in the view.

    2. to sort or group by the column headings name Menu

    (A) move your mouse pointer on the name of column that you want to have the organized window items by, and then click the arrow to the right. (See the screenshots below step 3)

    (B) you can now select to Sort by or Group by window by that name of column headers. (See screenshots below)
    NOTE: What you see in your window will also depend on what you have the model file and set as.

    OR

    3. to select to arrange by column name headers
    NOTE: This will allow you to change quickly of name of column titles window is organized by with always using the Sort By or Group By setting that you set in step 2 or ONE OPTION above.

    (A) click on the column header name. (See the screenshots below step 2)
    NOTE: Any name of column headers from the triangle , is one that is organized by the window.

    (B) click on the same column header name until you have the Ascending or Descending order you want. (See the screenshots below step 2)
    NOTE: When the triangle in the name of column headings is directed upwards, then it goes down. If the triangle in the name of column headings is directed downwards, then it is ascending.

    OPTION THREE

    To change to "be represented by" view folders in the libraries

    Note
    Reorganize by is only available in the folders in the library . The Arrange by options vary according to the model of folder in the library folder. All the included files and subfolders in a library will always share the same point of view of folder. You are able to have separate "reorganize by ' display the parameters in each added right-click-> New-> folder created in the library itself however.

    • The Windows search Service must be on Automatic and started to make this option work.
    • Disabling the index in Windows 7 you will be not be able to use reorganize by inlibraries.

    1. open the library folder that you want to change the display of reorganize by files.

    2 click themenu bar displayitem and select reorganize by and the option to use the files in the folder library arranged. (See screenshot below)

    OR

    3 click the toolbar option of reorganize by , then select reorganize by and the drop down menu the menu option for how you want the files in the folder library arranged. (See screenshot below)

    4 all included files in the library will now even reorganize by fixed for these institutions. The library will always open with the same setting of reorganize by he had during its last closure.

    That's right, Source: http://www.sevenforums.com/tutorials/3952-file-folder-arrangement-group-sort-arrange.html

  • SQL sort order?

    When installing UCCE I use the ICMDBA to create the base of data but get this error:

    "The sorting order of SQL Server on this computer is not binary. You can't go any further.

    Anyone know how you can change the SQL sort order?

    Hello

    To change the SQL Server "Binary order", you will need to reinstall SQL Server and select 'Custom' config Binary order (Latin1_General) for installation.

    Follow the instructions in this link:

    http://www.Cisco.com/application/PDF/en/us/guest/products/ps1001/c1225/ccmigration_09186a00804d72f9.PDF

    See Chapter 10. This installation of SQL procedure is valid for all IPCC Enterprise versions in SQL Server 2000.

    Hope this helps,

    Juan Luis

  • latitude longitude coordinates SQL Server and the plot on the map of the brochure

    My question is basically:

    How to transform the data from SQL Server and map by unfolding?

    TIP: We run 11 Coldfusion, SQL Server 2000, flyer and JQuery if that helps somehow. If I need to download a javascript library, I can easily do.

    I ambulance and fire events in a database with the xy coordinates. My goal is to ask them about the news and place them on a map of the brochure. All our ambulances and fire trucks have gps in them and they broadcast at all times their location and status. Here's my query to get the latest data from gps for each truck;

    /*

    SQL Server 2000

    David Kulpanowski

    June 4, 2015

    Lee County EMS

    */

    SELECT

    DateTimeStamp

    RTRIM (CallSign) AS [Guide]

    RTRIM (UnitStatus) AS [UnitStatus]

    Latitude

    Longitude

    CONVERT (VARCHAR (15), DateTimeStamp, 106) AS [CurrentDate]

    CONVERT (VARCHAR (10), DateTimeStamp, 108) AS [CurrentTime]

    OF FireEMSGPSDatabase

    RIGHT OUTER JOIN

    (

    SELECT

    RTrim (CallSign) AS [Ambulance]

    MAX (DateTimeStamp) AS [MostRecentTime]

    OF HISTORY_201506

    WHERE RTRIM (CallSign) AS "LCM__".

    RTRIM GROUP (CallSign)

    )

    LIKE [MostRecent] on DateTimeStamp = MostRecent.MostRecentTime

    ORDER BY RTRIM (CallSign) CSA

    ;

    Shown below is an example of this query output;

    Call DateTimeStamp Latitude UnitStatus Longitude CurrentDate CurrentTime

    2015-06-04 17:14:17.357 LCM01 QA 26.56428 - 81.87044 June 4, 2015 17:14:17

    2015-06-04 17:14:17.357 LCM01 QA 26.56428 - 81.87044 June 4, 2015 17:14:17

    2015-06-04 17:14:18.670 LCM02 QA 26.64074 - 81.86507 June 4, 2015 17:14:18

    2015-06-04 17:14:34.420 LCM03 AR 26.64157 - 81.90973 June 4, 2015 17:14:34

    2015-06-04 17:14:20.420 LCM04 TA 26.63885 - 81.94159 June 4, 2015 17:14:20

    2015-06-04 17:14:21.297 LCM05 QA 26.4377 - 82.07806 June 4, 2015 17:14:21

    Below is my Coldfusion page with the flyer plan added in and the cfquery with cfoutput;

    <! DOCTYPE html >

    < html lang = "en" >

    < head >

    < meta http-equiv = "Content-Type" content = text/html"; Charset = UTF-8 "/ >"

    < meta name = "viewport" content = "width = device-width, original scale = 1.0" >

    " < link rel ="stylesheet"href =" http://CDN.leafletjs.com/leaflet-0.7/leaflet.CSS "/>

    " < script src =" http://CDN.leafletjs.com/leaflet-0.7.3/leaflet.js "> < / script > .

    < / head >

    < body >

    < cfquery datasource = "GPSDatabase" name = "AmbulanceLocation" >

    SELECT

    DateTimeStamp

    RTRIM (CallSign) AS [Guide]

    RTRIM (UnitStatus) AS [UnitStatus]

    Latitude

    Longitude

    CONVERT (VARCHAR (15), DateTimeStamp, 106) AS [CurrentDate]

    CONVERT (VARCHAR (10), DateTimeStamp, 108) AS [CurrentTime]

    OF FireEMSGPSDatabase

    RIGHT OUTER JOIN

    (

    SELECT

    RTrim (CallSign) AS [Ambulance]

    MAX (DateTimeStamp) AS [MostRecentTime]

    OF HISTORY_201506

    WHERE RTRIM (CallSign) AS "LCM__".

    RTRIM GROUP (CallSign)

    )

    LIKE [MostRecent] on DateTimeStamp = MostRecent.MostRecentTime

    ORDER BY RTRIM (CallSign) CSA

    < / cfquery >

    < cfoutput query = "AmbulanceLocation" >

    < table >

    < b >

    < td > #DateTimeStamp # < table >

    < td > #CallSign # < table >

    < td > #UnitStatus # < table >

    < td > #Latitude # < table >

    < td > #Longitude # < table >

    < td > #CurrentDate # < table >

    < td > #CurrentTime # < table >

    < /tr >

    < /table >

    < / cfoutput >

    < div id = ' map' > < / div >

    < script >

    var L.map = map ('plan' {Center: [26.5641867068354,-81.8704100173261], fullscreenControl: true, zoom: 12});

    L.tileLayer ('http://{s}.tile.osm.org/{z}/{x}/{y}.png').addTo(map);

    < /script >

    < / body >

    < / html >

    To sum it all up - I have a SQL Server query that retrieves the last my ambulances xy coordinates. I have a Coldfusion page that has a map of the brochure and the cfquery. My question is how to plot coordinates in a flyer plan. I can't understand the middle of the book to get the results of my query in terms of the brochure.

    In addition, it is a dynamic environment. Ambulances are constantly in motion. This page must be dynamic, so that the page can be updated to show the latest data.

    You must create the map and tile layer prior to place markers and then run your loop inside of the script tag.

    I highly recommend reading through the tutorials on the site of the brochure.  They go on these things in detail.

    Quick start - leaflet guide - a JavaScript library for the mobile environment maps

  • With separate SQL query and the counter is wrong.

    Hello

    I have another problem with a query.
    The following data:
    Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production
    CREATE      TABLE      TABLE_1
       
    (       "ORDER_NR"        VARCHAR2 (12)
    ,        "PRIORITY"        VARCHAR2 (2)
    ,        "WO_STATUS"        VARCHAR2 (1)
    ,        "STATUS_DATE"        DATE
    ,       "ART_NR"                      VARCHAR2 (9)
    ,       "DESCRIPTION"      VARCHAR2 (255)
    ,                 "PRICE"                     VARCHAR2 (10)
    );
    
    CREATE      TABLE      TABLE_2
    (     "ART_NR"            VARCHAR(9)
    ,     "MODELL"              VARCHAR2(10)
    ,     "MANUFACT"         VARCHAR2(20)
    );
    
    INSERT      INTO      TABLE_1      (ORDER_NR,              PRIORITY, WO_STATUS,  STATUS_DATE,                                             ART_NR,           DESCRIPTION,            PRICE) 
                  VALUES           ('1KKA1Z300612',     '12',     'U',        TO_DATE('05-FEB-13 10:22:39','DD-MON-RR HH24:MI:SS'),     '005231987',     '1ST ANNUAL SERVICE',   '5000.2546');
    INSERT      INTO      TABLE_1      (ORDER_NR,              PRIORITY, WO_STATUS,  STATUS_DATE,                                             ART_NR,           DESCRIPTION,            PRICE) 
                  VALUES           ('1KKA1Z300638',     '05',     'U',        TO_DATE('05-FEB-13 11:38:39','DD-MON-RR HH24:MI:SS'),     '005667821',     '3RD ANNUAL SERVICE',   '5269.7856');
    INSERT      INTO      TABLE_1      (ORDER_NR,              PRIORITY, WO_STATUS,  STATUS_DATE,                                             ART_NR,           DESCRIPTION,            PRICE) 
                  VALUES           ('1KKA1Z300638',     '12',     'U',        TO_DATE('06-FEB-13 12:38:39','DD-MON-RR HH24:MI:SS'),     '005667821',     '1ST BIENNIAL SERVICE', '1234.4468');
    INSERT      INTO      TABLE_1      (ORDER_NR,              PRIORITY, WO_STATUS,  STATUS_DATE,                                             ART_NR,           DESCRIPTION,            PRICE) 
                  VALUES           ('1KKA1Z300638',     '12',     'U',        TO_DATE('07-FEB-13 13:38:39','DD-MON-RR HH24:MI:SS'),     '005667821',     '3RD ANNUAL SERVICE',   '4366.7856');
    INSERT      INTO      TABLE_1      (ORDER_NR,              PRIORITY, WO_STATUS,  STATUS_DATE,                                             ART_NR,           DESCRIPTION,            PRICE) 
                  VALUES           ('1KKA1Z300762',     '12',     'U',        TO_DATE('22-FEB-13 14:55:48','DD-MON-RR HH24:MI:SS'),     '018743356',     '3RD ANNUAL SERVICE',   '4462.8632');
    INSERT      INTO      TABLE_1      (ORDER_NR,              PRIORITY, WO_STATUS,  STATUS_DATE,                                             ART_NR,           DESCRIPTION,            PRICE) 
                  VALUES           ('1KKA1Z300766',     '12',     'U',        TO_DATE('22-FEB-13 08:32:13','DD-MON-RR HH24:MI:SS'),     '018743356',     '2ND ANNUAL SERVICE',   '8762.6643');
    INSERT      INTO      TABLE_1      (ORDER_NR,              PRIORITY, WO_STATUS,  STATUS_DATE,                                             ART_NR,           DESCRIPTION,            PRICE) 
                  VALUES           ('1KKA1Z300766',     '05',     'U',        TO_DATE('23-FEB-13 12:32:13','DD-MON-RR HH24:MI:SS'),     '018743356',     '1ST BIENNIAL SERVICE', '3425.6643');
    INSERT      INTO      TABLE_1      (ORDER_NR,              PRIORITY, WO_STATUS,  STATUS_DATE,                                             ART_NR,           DESCRIPTION,            PRICE) 
                  VALUES           ('1KKA1Z300766',     '12',     'U',        TO_DATE('24-FEB-13 14:32:13','DD-MON-RR HH24:MI:SS'),     '018743356',     '2ND BIENNIAL SERVICE', '6678.6643');
    INSERT      INTO      TABLE_1      (ORDER_NR,              PRIORITY, WO_STATUS,  STATUS_DATE,                                             ART_NR,           DESCRIPTION,            PRICE) 
                  VALUES           ('1KKA1Z300612',     '12',     'U',        TO_DATE('06-FEB-13 10:22:39','DD-MON-RR HH24:MI:SS'),     '005231987',     '1ST ANNUAL SERVICE',   '5000.2546');
    INSERT      INTO      TABLE_1      (ORDER_NR,              PRIORITY, WO_STATUS,  STATUS_DATE,                                             ART_NR,           DESCRIPTION,            PRICE) 
                  VALUES           ('1KKA1Z300638',     '05',     'U',        TO_DATE('05-FEB-13 11:38:39','DD-MON-RR HH24:MI:SS'),     '005667821',     '3RD ANNUAL SERVICE',   '5269.7856');
    INSERT      INTO      TABLE_1      (ORDER_NR,              PRIORITY, WO_STATUS,  STATUS_DATE,                                             ART_NR,           DESCRIPTION,            PRICE) 
                  VALUES           ('1KKA1Z300638',     '12',     'U',        TO_DATE('06-FEB-13 12:38:39','DD-MON-RR HH24:MI:SS'),     '005667821',     '1ST BIENNIAL SERVICE', '1234.4468');
    INSERT      INTO      TABLE_1      (ORDER_NR,              PRIORITY, WO_STATUS,  STATUS_DATE,                                             ART_NR,           DESCRIPTION,            PRICE) 
                  VALUES           ('1KKA1Z300638',     '12',     'U',        TO_DATE('07-FEB-13 13:38:39','DD-MON-RR HH24:MI:SS'),     '005667821',     '3RD ANNUAL SERVICE',   '4366.7856');
    INSERT      INTO      TABLE_1      (ORDER_NR,              PRIORITY, WO_STATUS,  STATUS_DATE,                                             ART_NR,           DESCRIPTION,            PRICE) 
                  VALUES           ('1KKA1Z300762',     '12',     'U',        TO_DATE('22-FEB-13 14:55:48','DD-MON-RR HH24:MI:SS'),     '018743356',     '3RD ANNUAL SERVICE',   '4462.8632');
    INSERT      INTO      TABLE_1      (ORDER_NR,              PRIORITY, WO_STATUS,  STATUS_DATE,                                             ART_NR,           DESCRIPTION,            PRICE) 
                  VALUES           ('1KKA1Z300766',     '12',     'U',        TO_DATE('22-FEB-13 08:32:13','DD-MON-RR HH24:MI:SS'),     '018743356',     '2ND ANNUAL SERVICE',   '8762.6643');
    INSERT      INTO      TABLE_1      (ORDER_NR,              PRIORITY, WO_STATUS,  STATUS_DATE,                                             ART_NR,           DESCRIPTION,            PRICE) 
                  VALUES           ('1KKA1Z300766',     '05',     'U',        TO_DATE('23-FEB-13 12:32:13','DD-MON-RR HH24:MI:SS'),     '018743356',     '1ST BIENNIAL SERVICE', '3425.6643');
    INSERT      INTO      TABLE_1      (ORDER_NR,              PRIORITY, WO_STATUS,  STATUS_DATE,                                             ART_NR,           DESCRIPTION,            PRICE) 
                  VALUES           ('1KKA1Z300766',     '12',     'U',        TO_DATE('24-FEB-13 14:32:13','DD-MON-RR HH24:MI:SS'),     '018743356',     '2ND BIENNIAL SERVICE', '6678.6643');
    
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005231987',     'X-RAY1',          'MANUFACT1');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005231987',     'X-RAY1',          'MANUFACT2');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005231987',     'X-RAY1',          'MANUFACT3');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005231987',     'X-RAY1',          'MANUFACT4');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005231987',     'X-RAY1',          'MANUFACT5');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005231987',     'X-RAY1',          'MANUFACT6');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005667821',     'LASER',          'MANUFACT1');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005667821',     'LASER',          'MANUFACT2');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005667821',     'LASER',          'MANUFACT3');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005667821',     'LASER',          'MANUFACT4');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('018743356',     'VACCUM',          'MANUFACT1');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('018743356',     'VACCUM',          'MANUFACT2');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('018743356',     'VACCUM',          'MANUFACT3');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('018743356',     'VACCUM',          'MANUFACT4');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('018743356',     'VACCUM',          'MANUFACT5');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('018743356',     'VACCUM',          'MANUFACT6');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005231987',     'X-RAY1',          'MANUFACT1');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005231987',     'X-RAY1',          'MANUFACT2');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005231987',     'X-RAY1',          'MANUFACT3');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005231987',     'X-RAY1',          'MANUFACT4');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005231987',     'X-RAY1',          'MANUFACT5');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005231987',     'X-RAY1',          'MANUFACT6');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005667821',     'LASER',          'MANUFACT1');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005667821',     'LASER',          'MANUFACT2');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005667821',     'LASER',          'MANUFACT3');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005667821',     'LASER',          'MANUFACT4');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('018743356',     'VACCUM',          'MANUFACT1');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('018743356',     'VACCUM',          'MANUFACT2');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('018743356',     'VACCUM',          'MANUFACT3');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('018743356',     'VACCUM',          'MANUFACT4');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('018743356',     'VACCUM',          'MANUFACT5');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('018743356',     'VACCUM',          'MANUFACT6');
    COMMIT;
    And my request:
    SELECT T1.ART_NR
    , T2.MODELL
    , SUM(ROUND(T1.PRICE, 2)) AS TOTAL_PRICE
    , COUNT(*) AS QTY
    , TO_CHAR(T1.STATUS_DATE, 'MON-RR') AS MONTH
    FROM TABLE_1 T1, TABLE_2 T2
    WHERE T1.WO_STATUS = 'U'
    AND T1.ART_NR = T2.ART_NR
    AND TO_CHAR(T1.STATUS_DATE, 'MON-RR') = 'FEB-13'
    GROUP BY T2.MODELL
    , T1.ART_NR
    , TO_CHAR(T1.STATUS_DATE, 'MON-RR')
    And the result:
    ART_NR      MODELL     TOTAL_PRICE        QTY     MONTH
    ---------        ----------       -----------                ---------- ------
    018743356 VACCUM     559916.16            96        FEB-13 
    005667821 LASER        173936.48            48        FEB-13 
    005231987 X-RAY1          120006             24        FEB-13
    My problem now is the OTY ist wrong field should count how many times the equipment was in service in Feb - 13 and group them by "MODEL" the production area is not interesting to me, but this is my problem, a model can have several Manufacter and so I had a bad count for my Qty.

    The next step that I need is to group the result also by type of Service (annual or biannual), like this:
    ART_NR      MODELL     TOTAL_PRICE        QTY     MONTH   SERVICE_TYPE
    ---------        ----------       -----------                ---------- ------        ---------------------
    018743356 VACCUM      1234.56               4         FEB-13     ANNUAL
    018743356 VACCUM      4423.48               10       FEB-13     BIENNIAL
    005667821 LASER         4783.11               2         FEB-13     ANNUAL
    005667821 LASER         1123.77               22       FEB-13      BIENNIAL
    005231987 X-RAY1        8966.12               6        FEB-13      ANNUAL
    005231987 X-RAY1        7826.44              12        FEB-13      BIENNIAL
    These values are only out of my head, not the table, just to show what I need.

    Thanks for your help.

    Hosts Reinhard

    Hello

    990524 wrote:
    Hello

    Wow it's great.
    Thanks Frank.

    In my database, this query works like a charm, but I have a problem, sometimes the round command do not work then I get a total price of 1231.0000000000001, I
    tried of TRUNCATES the value, but it's always the same value.

    Sorry, I can not re - create the problem.

    And I put another line in the query that calculates the average price per model:

    , ROUND ( SUM (g.price) / COUNT(*) ,2 ) AS average
    

    Why not just

    , ROUND (AVG (g.price), 2)   AS average
    

    ?

    and in this line, I have the same problem with bad ROUNDS.

    Do you have an idea in this case?

    No, sorry. If I can't get the same behavior, myself, it is not that I do.

    Instead of ROUND, you can use TO_CHAR to (for example) display 2 digits after the decimal point. To_char will automatically round the result. Your front end (for example, the SQL * Plus COLUMN...) FORMAT command) can probably do the same thing.

  • Rewrite the query with joins, and group by

    Hello

    It's an interview question.

    Table names: bookshelf_checkout
    virtual library

    And the join condition between these two tables is title

    We need to rewrite under request without using the join condition and group by clause?

    SELECT b.title,max(bc.returned_date - bc.checkout_date) "Most Days Out"
               FROM bookshelf_checkout bc,bookshelf b
               WHERE bc.title(+)=b.title
               GROUP BY b.title;
    When I was in College, I read most of SELECT statements can be replaced by operations base SQL (DEFINE the OPERATORS). Now, I am rewriting the query with SET operators, but not able to get the exact result.

    Kindly help me on this.

    Thank you
    Suri

    Something like that?

      1  WITH books AS (
      2  SELECT 'title 1' title FROM dual UNION ALL
      3  SELECT 'title 2' FROM dual UNION ALL
      4  SELECT 'title 3' FROM dual ),
      5  bookshelf AS (
      6  SELECT 'title 1' title, DATE '2012-05-01' checkout_date, DATE '2012-05-15' returned_date FROM dual UNION ALL
      7  SELECT 'title 1' title, DATE '2012-05-16' checkout_date, DATE '2012-05-20' returned_date FROM dual UNION ALL
      8  SELECT 'title 2' title, DATE '2012-04-01' checkout_date, DATE '2012-05-15' returned_date FROM dual )
      9  SELECT bs.title, MAX(bs.returned_date - bs.checkout_date) OVER (PARTITION BY title) FROM bookshelf bs
     10  UNION
     11  (SELECT b.title, NULL FROM books b
     12  MINUS
     13* SELECT bs.title, NULL FROM bookshelf bs)
    SQL> /
    
    TITLE   MAX(BS.RETURNED_DATE-BS.CHECKOUT_DATE)OVER(PARTITIONBYTITLE)
    ------- ------------------------------------------------------------
    title 1                                                           14
    title 2                                                           44
    title 3
    

    Lukasz

  • Unable to get the database searched with MAX and GROUP BY function

    Hello
    All the

    I have a table as below:
    COLUMN TYPE
    User_id VARCHAR2 (10 byte)
    ID_processus VARCHAR2 (30 bytes)
    END_TIME DATE (STAMP)
    TO_LOC VARCHAR2 (12 bytes)
    TO_LOC_TYPE VARCHAR2 (15 bytes)
    FROM_LOC VARCHAR2 (12 bytes)
    ITEM_ID VARCHAR2 (25 bytes)
    CASE NUMBER (12.4)
    LMS_UDA1 VARCHAR2 (250 bytes)
    AREA VARCHAR2 (2 bytes)

    I only want to get one record with all the columns, have only one clause MAX (END_TIME)
    But the other column value of the difference.
    When I use MAX (END_TIME) and GROUP OF USER_ID, ID_processus, CASE...
    the sql did not a single record,
    It gives the number of records

    Please help me on this

    Concerning

    Saven

    >
    I only want to get one record with all the columns, have only one clause MAX (END_TIME)
    But the other column value of the difference.
    >
    Maybe it's not possible because it depends on your data.

    If the combination of all columns except END_TIME is not unique then there will be multiple records; a record for each unique combination (GROUP BY) of all other columns.

    The only way to ensure that a record is

    SELECT MAX(END_TIME) FROM myTable
    
  • Cases and Group by

    I tried to understand what is the problem with a large sql query that does not change what I do.
    Have managed to isolate the part which is a failure, but I get the error message:

    ORA-00979: not a GROUP BY expression

    is not very useful.

    I suspect there is something fundamentally wrong in what I'm trying to do.

    I had to anonimise the names of the tables and fields that the data that I use is quite sensitive, but it should not forget the problem.

    Here is the query:
    select
    case when a='100' and cost in (select cost from lookup) then '100' else b end as main,
    count(*)
    from 
    data_table
    group by 
    case when a='100' and cost in (select cost from lookup) then '100' else b end
    DATA_TABLE has (among others) of fields:
    a, b, and the cost

    search contains the field:
    cost

    All fields are VARCHAR2 (255)


    If I remove the count (*) and any group of the query statement runs it is to say:
    select
    case when a='100' and cost in (select cost from lookup) then '100' else b end as main
    from 
    data_table
    This shows that the stated case is valid - then why I can not combine the count and group of?
    If this is a reason of syntax is there another solution that I can possibly use subqueries to work around the problem - I prefer to avoid this and can't really make the case in a decoding without him make mess.

    Oracle version:
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.

    TIA

    Published by: user8378443 on May 11, 2011 10:26

    Try like this,

    SELECT MAIN, COUNT (*)
      FROM (SELECT CASE
                      WHEN A = '100'
                       AND COST IN (SELECT COST FROM lookup)
                      THEN '100' ELSE b
                   END
                      AS MAIN
              FROM data_table)
    GROUP BY MAIN
    

    G.

  • Sorting and null for currency values in a report

    All,
    I think this should be easy, and I just missed something obvious.
    I have an APEX 3.2.1 standard report that includes a column with a monetary value in it. I want the column to display the UK pound sign to be able to sort and display NULL values, as appropriate.
    The question I have is that I can't find a way to reach all 3 in a medium satisfctory. As I see the options would be:

    (1) in the SQL for the report, concat the pound sign in the required column, for example SELECT "£". amount OF the...
    The problem is that it makes this field a CHAR field, so sorting is not sort of the same way as for a numeric field.

    (2) use the format FML999 number... etc in the column attribute.
    The problem with this is that it is a multi-country database, and the default currency unit is the value of the U.S. dollar.

    (3) expression box to use HTML code in the column attribute to display £#COL #.
    It fills the pound sign and keep the number format, but unfortunately a null value is displayed as a sign of pounds with no number. I do not see how so he can leave this value in the report as completely empty.

    As I said, I'm sure I missed obvious soemthing. If someone can identify how to achieve this it would be much appreciated.

    Kind regards
    Jon.

    >
    (2) use the format FML999 number... etc in the column attribute.
    The problem with this is that it is a multi-country database, and the default currency unit is the value of the U.S. dollar.
    >

    The NLS currency symbol can be changed on the fly if you have a few ways to identify the location/preference of the user: {: identifier of the thread = 990848} (ignore the last post)

    However, it probably doesn't make sense to do - ≠ £100 $100 (at least I hope not!) - unless there is some sort of conversion occurring in the report? Is there a currency stored and the amount?
    >
    (3) expression box to use HTML code in the column attribute to display £#COL #.
    It fills the pound sign and keep the number format, but unfortunately a null value is displayed as a sign of pounds with no number. I do not see how so he can leave this value in the report as completely empty.
    >
    Use 2 columns, one for the amount and one for the money, with a switch to include or exclude it if necessary:

    select
              ename
            , comm amount
            , nvl2(comm, '£', null) currency
    from
              emp
    where
              job in ('SALESMAN', 'MANAGER')
    
    ENAME      AMOUNT                 CURRENCY
    ---------- ---------------------- --------------------------------
    ALLEN      300                    £
    WARD       500                    £
    JONES
    MARTIN     1400                   £
    BLAKE
    CLARK
    TURNER     0                      £                                
    

    Then use the two columns in the Expression of the amount of HTML:

    #CURRENCY##AMOUNT#
    
  • ADG custom sort and icons

    I've got flat of data from AMFPHP as a collection of array of objects with properties such as

    type
    grade
    day_number
    Object
    ...

    Some of the data is special, marked as a "Viper" (Adder = 1). The Adder must appear at the top of the list and have a specific icon (sign more or something). All other entries should be sorted alphabetically, under the Adder and have another icon (trash).

    When the user clicks on the "adder", they revise their new entry, once completed, the entry is added to the list and the Adder is maintained. A similar behavior in powerpoint when creating bullets (a temporary entry waiting a tool for editing, when it exists, a new entry is created).

    I read until I can't stand more... people talk about the custom item renders, subclassing etc. I understand that, however, I have no idea of what I need to do (what functions of overload) to achieve this behavior.

    In addition, the data are grouped through a group collection, so that the user can navigate to a specific day, grade and then the class to add/change. Again, I would change the icons for folders according to their function.


    In summary:
    1. what should I do to customize the sorting of data in the ADG (first take an element of the kind and everything).
    2. what should I do to change the icons of specific so that some icons will be trash and other nodes will be signs more.
    3. what should I do to change the behavior of itemClick so that if the user clicks on an element with a recycle bin, the item is deleted, but not if the user clicks on an element with a sign more.
    4. what should I do to change folder icon based on the item type and depth of the order of the day (so that each level has a different icon).

    If it's simple, I apologize. Everything seems easy for people in flex, and yet I've worked dozens of hours on this stupid problem and can not solve. Flex could be great if I could understand this shit... Go to PHP! : o).

    "MacGyverMan" wrote in message
    News:gd0so7$2u5$1@forums. Macromedia.com...
    > I've got flat of data from AMFPHP as a collection of array of objects
    > with
    > properties such as
    >
    > type
    > grade
    > day_number
    > topic
    > ...
    >
    > Some data is special, marked as a "Viper" (Adder = 1). The Adder
    > must
    > appears at the top of the list and have a specific icon (sign more or less)
    (> something). All other entries should be sorted alphabetically under the
    > Adder and
    > have a different icon (trash).
    >
    > When the user clicks on the "adder", they are revising their new entry, on
    > completion.
    > the entry is added to the list and the Adder is maintained. A behavior
    > similar
    > to powerpoint when creating bullets (a temporary entrance waiting for a change, if)
    > It
    (> is one, a new entry is created).
    >
    > I read until I can't... do the people speak
    > custom
    > point renders, etc. the subclassing. I understand that, however, I have no idea
    > what
    > I do (what functions of overload) to achieve this behavior.
    >
    > In addition, the data are grouped through a group collection, so that the user can
    > go to a specific day, grade and then the class to add/change. Again, I got
    > as
    > change the icons for folders according to their function.
    >
    >
    > In summary:
    > 1. What should I do to customize the sorting of data in the ADG (take an element
    > out
    (> sorting and put everything first).

    According to me, is the only type of hierarchical Collection, you can do it with one
    GroupingCollection. You will need to use a compareFunction on the Group
    and/or GroupingField to always return-1 for that particular item.

    > 2. What should I do to change the icons of specific end-nodes as well as some
    > icons
    > will be trash and some signs will be more.

    Watch iconFunction.
    http://livedocs.Adobe.com/Flex/3/langref/MX/controls/listclasses/AdvancedListBase.html#ICO nFunction

    Despite what say the docs for AdvancedDataGrid, he _does_ support the
    iconFunction property.

    > 3. What should I do to change the itemClick behavior so that the user case
    > click on
    > an article with a trash can, the item is deleted but not if the user clicks
    > a
    > point with a sign more.

    The ListEvent you get from itemClick will have a property called
    currentTarget. If you look at currentTarget.data, it will be the
    information on the entire line. Check what property you used in your
    iconFunction show trash vs the sign, to the
    different features.

    > 4. What should I do to change based on the type of element folder icon and the
    > article
    > depth (so that each level has a different icon).

    Look at the docs for groupIconFunction.
    http://livedocs.Adobe.com/Flex/3/HTML/advdatagrid_06.html

    > If it's simple, I apologize. Everything seems simple for people to
    > flex,.
    > and still I've worked dozens of hours on this stupid problem and cannot
    > solve
    > it. Flex could be great if I could understand this shit... Go to PHP!
    > :o)

    It all takes a long time to understand what is happening in Flex, but
    Once you do, it's amazing :-).

    I did an example with a GroupingCollection you can or can not find
    useful, since I deliberately _not_ use it for an ADG.
    http://flexdiary.blogspot.com/2008/09/GroupingCollection-example-featuring.html

    I also have a demo here that shows using an iconFunction, although, once again, do not
    with an ADG
    http://flexdiary.blogspot.com/2008/08/TileList-with-stylefunction.html

    HTH;

    Amy

  • Different output for the same query in SQL Server and Oracle

    I have two tables table1 and table2

    -table1 has two columns c1 int and varchar c2. There are no constraints added in it. It contains data as shown below

    C1 c2
    -------------------
    d 6
    5 d
    102 g
    6%
    f 103
    5.
    501 j
    1 g
    601 n
    2 m

    -table2 has only a single column c1 int. There is no added in constraints. It contains data as shown below

    C1
    ----
    6
    1
    4
    3
    2

    now when I run below, given the query in sql server and oracle it gives me different results

    Select *.
    FROM table1
    table2 on table2.c1 = table1.c1 inner join (SELECT ROW_NUMBER() (any ORDER by ASC c1) AS c1 from table2)

    output of SQL server
    ------------------------
    C1 c2 c1
    --------------------------------
    1 g 1
    2 m 2
    3 h 3
    4 g 4
    5 d 5


    release of Oracle
    ----------------------
    C1 C2 C1
    ---------------------------------
    5 d 5
    4 g 4
    3 h 3
    1 g 1
    2 m 2


    If you notice the first column in the two outputs. It is sorted in sql server and no oracle.

    Why he behaves differently in oracle? Is there a way I can fix this problem in oracle?

    Thank you
    Jigs

    It is NOT a behavior "differently" in Oracle; you did not specify just an order that you expect of your results, so you'll get output in what order the fantasies of the database showing (ie. no guaranteed order). It is an artifact of the way the database chooses to collect the data and databases (or same sets of data within the same database) can and will most likely behave differently.

    Same SQL Server will not be guaranteed to always get your data in an orderly manner if you exclude the order by clause, even if you think that there always display the data in an orderly manner.

    Your solution is to add an order by clause, in the TWO databases, to force the order of the data output.

  • Need help with query SQL Inline views + Group

    Hello gurus,

    I would really appreciate your time and effort on this application. I have the following data set.

    Reference_No---Check_Number---Check_Date---description---Invoice_Number---Invoice_Type---Paid_Amount---Vendor_Number
    1234567 11223 - 05/07/2008 -paid for cleaning- 44345563-I-* 20.00 *---19
    1234567 11223 - 05/07/2008 - 44345563 -a--10,00---19 ofbad quality adjustment
    7654321 11223 - 05/07/2008 - setting the last billing cycle - 23543556 - A - 50.00 - 19
    4653456 11223 - 05/07/2008 - paid for cleaning - 35654765 - I - 30, 00-19

    Please ignore '-' added for clarity

    I'm writing a paid_amount based on Reference_No, Check_Number, Payment_Date, Invoice_Number, aggregate query Invoice_Type, Vendor_Number and display description with Invoice_type 'I' when there are multiple records with the same Reference_No, Check_Number, Payment_Date, Invoice_Type, Invoice_Number, Vendor_Number. When there are no more records I want to display the respective Description.

    The query should return the following data set

    Reference_No---Check_Number---Check_Date---description---Invoice_Number---Invoice_Type---Paid_Amount---Vendor_Number
    1234567 11223 - 05/07/2008 -paid for cleaning- 44345563-I-* 10.00 *---19
    7654321 11223 - 05/07/2008 - setting the last billing cycle - 23543556 - A - 50.00 - 19
    4653456 11223 - 05/07/2008 - paid for cleaning - 35654765 - I - 30, 00-19
    Here's my query. I'm a little lost.

    Select b., A.sequence_id, A.check_date, A.check_number, A.invoice_number, A.amount, A.vendor_number
    de)
    Select sequence_id, check_number, check_date, invoice_number, sum (paid_amount) sum, vendor_number
    of the INVOICE
    Sequence_id group check_date, check_number, invoice_number, vendor_number
    ) A, B OF INVOICE
    where A.sequence_id = B.sequence_id


    Thank you
    Nick

    It seems that this is a duplicate thread - correct me if I am wrong in this case->

    Need help with query SQL Inline views + Group

    Kind regards.

    LOULOU.

  • How can I restore my tabs and groups of tabs after a update to version 36.0?

    I work with many tabs when I use Firefox. I keep classified in groups of tabs, which helps to separate the different children to work I do and interests I have. I have been using this environment for years. When I started my job today, Firefox updated to v36.0, and noted the following behaviors:

    1. There is only one group of tabs when you try to display tabs at Panorama, as opposed to a dozen groups;

    2. normally if the hidden tabs (tabs in the same group as the startup group, and not the default page) downloading of content to what the user clicks on, icon, if any, and the name of the page will show on the tab currently, the tabs display 'New tab' and no icon. It seems, however, the number of tabs that exist across all groups of tabs, but are now ghosts this default value, a group of tabs. I must add, however, I do not count the number of tabs, so I can't be exactly. When you click on it, there is just a blank page. It is so strange that Firefox knows they are there but cannot simply attach the address.

    I tried to restore the following files from my backup of Windows Home Server to the folder AppData\Roaming\Mozilla\Firefox\Profiles\ .default < gobbletygook >:

    1. in the sessionstore-backups folder, I replaced the files previous.js, recovery.bak and recovery.js (not all of the upgrade ~) with the files yesterday and the day before yesterday.

    When that did nothing, I replaced

    2 sessionCheckpoints.json

    I do not see any file with a recent date that seems to be the one that I have to restore. I should add that I don't see hidden files. I thought about the restoration of the whole of the batch, but didn't know how it would affect the program v36.0 and the profile on 35.0.1 files.

    I have deadlines this week and must immediately restore my environment in order to make these possible. I have no address list on my Web pages to work in IE or other. Any help would be much appreciated.

    On a second note, I had been wondering recently if this tab group environment is an appropriate way to maintain my work environment. Sometimes, during the opening of Panorama, I would get an error saying a script takes too much time, but if I clicked on continue, it would display the groups in a few seconds. I considered bringing it in bookmarks, but it would be tedious and more difficult to access and open several tabs. Initially, I tried tabs groups thinking it was just a matter of maintaining a table of addresses (in tabs) with a name or an ID of tab group. How that might go wrong? Well, there, so it is obviously more complicated than that, and I did not know that upgrades would affect the data of a personal nature. That I should abandon the use of tab groups?

    With the help of information from the user, ptressel, in a post here on the existence of sessionstore.js when version 33 was released, I could easily get my tabs and groups of tabs as follows:

    1. close Firefox and, perhaps, wait a few seconds (30 years?) for any final closing of files;
    2. Check if you have a sessionstore.js file in your profile folder, named as I documented in my original post above.
    3. If this is not timestamped before the discovery of your problem, open the sessionstore-backups folder.
    4. Check if the recovery.js file is properly stamped and, if not, the recovery.bak.
    5. At this point, you are likely to find that none of them is before your problem occurring. If so, open your backups from this folder and go through steps 2 to 4 to find a file before your problem occurring.
    6. When you find a file, copy it to the root of your current profile folder and name it, "sessionstore.js.
    7. Open Firefox. Mine opened upwards as you wish.

    It is a solution for Windows. Sorry I can't comment on other platforms, but I'd bet it's just a copy of file and change of name, it is likely even.

    For Windows users, you can find you must sign out and sign in as administrator in order to access backups. You must not logoff your standard account, but do have Firefox closed as described above.

    Hope that helps.

Maybe you are looking for