Need Store DB tables to query to get the latest scanned price at register

Need Store DB tables to query to get the latest scanned price at register.
Please provide a sample sql script that will help me do this. I need to have this informatino for several items at a time.
Thanks,
Edited by: user10133807 on Jan 13, 2012 9:22 AM
Edited by: user10133807 on Jan 13, 2012 9:23 AM

Hi,
You can find multiple items saled price at the register by running below quary
select distinct DC_DY_BSN,ID_ITM_POS,MO_PRN_PRC from TR_LTM_SLS_RTN;
Thanks,
MG

Similar Messages

  • Query to identify the Latest Pur Price of a item's First PO doc Num & Date

    Hi Experts,
    Version: 2007B
    I want a query to do FMS in my purchase order UDF.
    The information i need in UDF through FMS is,
    I want the document number and Posting date of the first document of the Last purchase Price. Let me make it more clear with the example.
    I am creating a Purchase order of PO01 for a item XXXX1  on 12/3/11, and enter the price of INR 400.
    and again creating the Purchase order of PO25 for the same item as on 25/04/11, here since the last purchase is the price list am selected in the document level , it will show me as 400. its right.  now here i want the information in my UDF is   " Ref:PO01 as on 12/03/11"
    This information am using it to identify the LATEST PURCHASE PRICE'S FIRST DOCUMENT DATE AND ITS DOC NUMBER to give a proof to the supplier.
    Hope this information would explain my requirement.
    Regards,
    Dwarak
    Edited by: Dwarakanath.P on Apr 19, 2011 3:11 PM

    Dear GordonDu,
    While executing this query, am getting these errors.
    1). [Microsoft][SQL Native Client][SQL Server]Unclosed quotation mark after the character string ' as of +T0.DocDate  From OPOR T0 INNER JOIN POR1 T1 ON T1.DocEntry=T0.DocEntry  WHERE T1.ItemCode = $[$38.1.0]  ORDER BY T0.DocDate DESC FOR BROWSE '. 2). [
    2). [Microsoft][SQL Native Client][SQL Server]Incorrect syntax near '$38.1.0'. 2). [Microsoft][SQL Native Client][SQL Server]Statement 'Service Contracts' (OCTR) (s) could not be prepared.
    Please Let me make sure of my requirement once again in short.
    1)  I have created a UDF in a Purchase Oder at title level.
    2) next, i am creating a PO for 3 items.
    3)now, i want to display the 3 items doc no and Posting date of the first Puchase order of the latest price(Last price).
    thanks for your time, if you dont mind , and if you need i can also come in skype voice chat to clarrify my requirement friend.
    thanks & regards,
    Dwarak

  • Best query to get the latest version

    Hi,
    I have a table as below:
    col1 col2 col3.... col_ver col7
    I have a combination od values for col1 to col6. I have values in col7 which is different for each value in col_ver. col_ver is a version column.
    For a particular combination (col1 to col6) I want to get the rows with the maximum version. Can anyone suggest the best sql for this ?
    I have 2 options as below, please suggest from performance point of view which would be better (i don't have enough rows to test) and if there is a any other better way
    option 1:
    SELECT col1, col2, col3, col4, col5, col6, col_ver, col7
    FROM
    (SELECT col1, col2, col3, col4, col5, col6, col_ver, col7, MAX(col_ver) OVER (PARTITION BY col1, col2, col3, col4,
    col5, col6) MVER
    FROM tabA )
    WHERE col_ver = MVER;
    option2:
    SELECT col1, col2, col3, col4, col5, col6, col_ver, col7
    FROM tabA A
    WHERE col_ver = (SELECT MAX(col_ver) FROM tabA B
    WHERE
    B.col1 = A.col1
    AND B.col2 = A.col2
    AND B.col3 = A.col3
    AND B.col4 = A.col4
    AND B.col5 = A.col5
    AND B.col6 = A.col6);
    Thanks a lot in adavnce

    SQL> with t as
      2  (select 'a1' col1, 'b1' col2, 'c1' col3, 'd1' col4, 1 col_ver,  100 col7
      3     from dual
      4   union all
      5   select 'a1' col1, 'b2' col2, 'c1' col3, 'd1' col4, 1 col_ver,  101 col7
      6     from dual
      7   union all
      8   select 'a1' col1, 'b2' col2, 'c2' col3, 'd1' col4, 1 col_ver,  102 col7
      9     from dual
    10   union all
    11   select 'a1' col1, 'b2' col2, 'c2' col3, 'd2' col4, 1 col_ver,  103 col7
    12     from dual
    13   union all
    14   select 'a2' col1, 'b1' col2, 'c1' col3, 'd1' col4, 1 col_ver,  104 col7
    15     from dual
    16   union all
    17   select 'a2' col1, 'b2' col2, 'c1' col3, 'd1' col4, 1 col_ver,  105 col7
    18     from dual
    19   union all
    20   select 'a2' col1, 'b2' col2, 'c2' col3, 'd1' col4, 1 col_ver,  106 col7
    21     from dual
    22   union all
    23   select 'a2' col1, 'b2' col2, 'c2' col3, 'd2' col4, 1 col_ver,  107 col7
    24     from dual
    25   union all
    26   select 'a1' col1, 'b1' col2, 'c1' col3, 'd1' col4, 2 col_ver,  108 col7
    27     from dual
    28   union all
    29   select 'a1' col1, 'b2' col2, 'c2' col3, 'd1' col4, 2 col_ver,  109 col7
    30     from dual
    31   union all
    32   select 'a1' col1, 'b2' col2, 'c2' col3, 'd2' col4, 2 col_ver,  110 col7
    33     from dual
    34   union all
    35   select 'a2' col1, 'b2' col2, 'c1' col3, 'd2' col4, 2 col_ver,  111 col7
    36     from dual
    37   union all
    38   select 'a2' col1, 'b2' col2, 'c2' col3, 'd2' col4, 2 col_ver,  112 col7
    39     from dual
    40   union all
    41   select 'a1' col1, 'b2' col2, 'c2' col3, 'd2' col4, 3 col_ver,  113 col7
    42     from dual
    43   union all
    44   select 'a2' col1, 'b1' col2, 'c1' col3, 'd1' col4, 3 col_ver,  114 col7
    45     from dual)
    46  select * from t;
    CO CO CO CO    COL_VER       COL7
    a1 b1 c1 d1          1        100
    a1 b2 c1 d1          1        101
    a1 b2 c2 d1          1        102
    a1 b2 c2 d2          1        103
    a2 b1 c1 d1          1        104
    a2 b2 c1 d1          1        105
    a2 b2 c2 d1          1        106
    a2 b2 c2 d2          1        107
    a1 b1 c1 d1          2        108
    a1 b2 c2 d1          2        109
    a1 b2 c2 d2          2        110
    a2 b2 c1 d2          2        111
    a2 b2 c2 d2          2        112
    a1 b2 c2 d2          3        113
    a2 b1 c1 d1          3        114
    15 rows selected.
    SQL> -- from here we only need to get those with the lastest value for the col_ver
    SQL> with t as
      2  (select 'a1' col1, 'b1' col2, 'c1' col3, 'd1' col4, 1 col_ver,  100 col7
      3     from dual
      4   union all
      5   select 'a1' col1, 'b2' col2, 'c1' col3, 'd1' col4, 1 col_ver,  101 col7
      6     from dual
      7   union all
      8   select 'a1' col1, 'b2' col2, 'c2' col3, 'd1' col4, 1 col_ver,  102 col7
      9     from dual
    10   union all
    11   select 'a1' col1, 'b2' col2, 'c2' col3, 'd2' col4, 1 col_ver,  103 col7
    12     from dual
    13   union all
    14   select 'a2' col1, 'b1' col2, 'c1' col3, 'd1' col4, 1 col_ver,  104 col7
    15     from dual
    16   union all
    17   select 'a2' col1, 'b2' col2, 'c1' col3, 'd1' col4, 1 col_ver,  105 col7
    18     from dual
    19   union all
    20   select 'a2' col1, 'b2' col2, 'c2' col3, 'd1' col4, 1 col_ver,  106 col7
    21     from dual
    22   union all
    23   select 'a2' col1, 'b2' col2, 'c2' col3, 'd2' col4, 1 col_ver,  107 col7
    24     from dual
    25   union all
    26   select 'a1' col1, 'b1' col2, 'c1' col3, 'd1' col4, 2 col_ver,  108 col7
    27     from dual
    28   union all
    29   select 'a1' col1, 'b2' col2, 'c2' col3, 'd1' col4, 2 col_ver,  109 col7
    30     from dual
    31   union all
    32   select 'a1' col1, 'b2' col2, 'c2' col3, 'd2' col4, 2 col_ver,  110 col7
    33     from dual
    34   union all
    35   select 'a2' col1, 'b2' col2, 'c1' col3, 'd2' col4, 2 col_ver,  111 col7
    36     from dual
    37   union all
    38   select 'a2' col1, 'b2' col2, 'c2' col3, 'd2' col4, 2 col_ver,  112 col7
    39     from dual
    40   union all
    41   select 'a1' col1, 'b2' col2, 'c2' col3, 'd2' col4, 3 col_ver,  113 col7
    42     from dual
    43   union all
    44   select 'a2' col1, 'b1' col2, 'c1' col3, 'd1' col4, 3 col_ver,  114 col7
    45     from dual)
    46  select a.col1, a.col2, a.col3, a.col4, a.col_ver, a.col7
    47    from (select t.col1, t.col2, t.col3, t.col4, t.col_ver, t.col7,
    48                 row_number() over (partition by t.col1, t.col2, t.col3, t.col4
    49                                    order by t.col_ver desc) rn
    50            from t) a
    51   where a.rn = 1;
    CO CO CO CO    COL_VER       COL7
    a1 b1 c1 d1          2        108
    a1 b2 c1 d1          1        101
    a1 b2 c2 d1          2        109
    a1 b2 c2 d2          3        113
    a2 b1 c1 d1          3        114
    a2 b2 c1 d1          1        105
    a2 b2 c1 d2          2        111
    a2 b2 c2 d1          1        106
    a2 b2 c2 d2          2        112
    9 rows selected.
    SQL>

  • MDX Query to show the latest product text again historical facts (Type 2 dimenion linking on Surrogate key and also Natural Key)

    I need to write a MDX query to show the latest product text again historical facts or a chosen product text in time. I can write this query in TSQL, but new to MDX.
    The way I do it in TSQL is joining two queries together on the Natural Key as opposed to the surrogate key.
    Can this be done in MDX. I know I could write two separate MDX queries, one which get the product text I wan and the other to get the measure with the actual product text and Natural Key, and use a lookup function in ssrs to show the two result sets I the
    same tablix by looking up the Natural Keys. But this should be able to be done in one query shouldn't it.
    In the dsv the fact knows to join to the dimension using the surrogate key.
    Thanks J

    Hi Jamster,
    According to your description, you want to write a query to show the latest product text, right?
    In MDX, we can use LastNonEmpty function to return the lastest member winth a dimension. LastNonEmpty is an aggregation function available in the Enterprise version of SQL Server. However, you can create your own with a little bit of recursive MDX. Here
    is a sample query for you reference.
    With Member Measures.LastHits as
    iif(isempty(Measures.Hits),
    ([Date].[Year Month Day].prevmember,
    Measures.LastHits
    ),Measures.Hits)
    Reference
    http://cwebbbi.wordpress.com/2011/03/24/last-ever-non-empty-a-new-fast-mdx-approach/
    http://richardlees.blogspot.com/2010/07/getting-last-non-empty-value.html
    If this is not what you want, please provide us the detail structure of your cube and the expected result, so that we can make further analysis and give you the exactly MDX query.
    Regards,
    Charlie Liao
    TechNet Community Support

  • Needs Query to get the cycle time automatically based on the value provided in the UDF on OWOR  table

    Dear all,
    Need a query to get the Cycle time in hr based on the value provide in the udf on OWOR table.
    Details of UDF:-
    1.Start date =10/07/14  (Field Name U_EA_REST)   
    2.Start time =10:00        (Field Name U_EA_REASTARTTIME)
    3.End date =11/07/14    (Field Name U_EA_REET)
    4.End Time=14:00          (Field Name U_EA_REAENDTIME
    Cycle Time=_______      (Field Name U_EA_REACYCLETIME)
    Regards,
    BanugopanRajendran

    Dear all,
    Need a query to get the Cycle time in hr based on the value provide in the udf on OWOR table.
    Details of UDF:-
    1.Start date =10/07/14  (Field Name U_EA_REST)   -  Date Type
    2.Start time =10:00        (Field Name U_EA_REASTARTTIME) - Hour Type
    3.End date =11/07/14    (Field Name U_EA_REET) - Date Type
    4.End Time=14:00          (Field Name U_EA_REAENDTIME - Hour Type
    Cycle Time=_______      (Field Name U_EA_REACYCLETIME) - Hour Type
    Regards,
    BanugopanRajendran

  • Query to get the data of all the columns in a table except any one column

    Can anyone please tell how to write a query to get the data of all the columns in a table except one particular column..
    For Example:
    Let us consider the EMP table.,
    From this table except the column comm all the remaining columns of the table should be listed
    For this we can write a query like this..
    Select empno, ename, job, mgr, sal, hiredate, deptno from emp;
    Just to avoid only one column, I mentioned all the remaining ( 7 ) columns of the table in the query..
    As the EMP table consists only 8 columns, it doesn't seem much difficult to mention all the columns in the query,
    but if a table have 100 columns in the table, then do we have to mention all the columns in the query..?
    Is there any other way of writing the query to get the required result..?
    Thanks..

    Your best best it to just list all the columns. Any other method will just cause more headaches and complicated code.
    If you really need to list all the columns for a table because you don't want to type them, just use something like...
    SQL> ed
    Wrote file afiedt.buf
      1  select trim(',' from sys_connect_by_path(column_name,',')) as columns
      2  from (select column_name, row_number() over (order by column_id) as column_id
      3        from user_tab_cols
      4        where column_name not in ('COMM')
      5        and   table_name = 'EMP'
      6       )
      7  where connect_by_isleaf = 1
      8  connect by column_id = prior column_id + 1
      9* start with column_id = 1
    SQL> /
    COLUMNS
    EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,DEPTNO
    SQL>

  • SQL query to get the Datetime 06 hours prior to the table Datetime value

    Hi Experts,
                    I'm just trying to create a SQL query to get the Datetime which should be 06 hours prior to my Table column value(Executiontime),
    Eg: my Executiontime(column) value is 07:00AM means, this query should fetch the detail of first VMName from table at 01:00AM, 
    SQL Table Name: TestTable
    Columns: VMName(varchar),status(varchar) Executiontime(Datetime)
    SQL Query : Select Top 1 VMName from
    TestTable where convert(date,Exeutiontime)=convert(date,getdate()) and
    status='0' and ExecutionTime > dateadd(hour,6,getdate())
    Request someone to alter this Query to my requirement or give me the new one.
    Regards,
    Sundar
    Sundar

    Hi All,
            Thanks for your Prompt response. I tried the below queries, but still I don't have any luck. Actually the queries are returning the value before the condition met (say when the time difference is more than 06 hours). I want the
    query to return exactly @ 06 hour difference or less than 06 hours,
    Query 01: Select Top 1 VMName from TestTable where
    convert(date,Exeutiontime)=convert(date,getdate())
    and status='0'
    and ExecutionTime >
    dateadd(hour,-6,getdate())
    Query 02: Select
    Top 1 VMName from TestTable where
    status='0'
    and ExecutionTime >
    dateadd(hour,-6,getdate())
    Query 03: Select
    Top 1 VMName from TestTable where status='0'
    and ExecutionTime >
    dateadd(hour,-6,ExecutionTime)
              Can someone point out the mistake please.
    Regards,
    Sundar
    Sundar

  • Query to get the name of the tables used in a View?

    Hi,
    Could you please help me in getting the name of the tables used in a perticular view?
    Please help me out...
    thnx in advance.
    Thnx,
    Bits
    Edited by: Bits on Sep 14, 2009 2:15 PM

    There is no data dictionary table that stores this directly.
    - You could get the DDL used to create the view and parse that SQL. Depending on how complex the view might be, this could be relatively easy or highly complex.
    - You could get a recursive list of the objects that the view depends on (from ALL_/USER_/DBA_DEPENDENCIES) and trace those dependencies back to all the tables that the view depends on. If your view calls functions, however, this may or may not be what you're looking for. If you are selecting from just one table in the FROM clause but you are calling a function that references a dozen tables, do you want one row? Or thirteen? What about tables referenced in a correlated subquery in the WHERE clause?
    Justin

  • Master Child tables how to get the latest rows from both

    Hi,
    Need some help with the sql. I have two tables Master & Child. In my Master table I have multiple rows for the same record and in the child table also multiple rows for the same master row how can I get the latest one's from both.
    For example Data in my Master table looks like
    CONT_ID                  SEQ_NUM        DESCRIPTION
    1                         189             Update 2
    1                         188             Update 1
    1                         187              NewNow in the child table for the same CONT_ID I may have the following rows
    CONT_ID                   UPDATED_DATE                                     STATUS
    1                        3/16/2010 2:19:01.552700 PM                          P
    1                        3/16/2010 12:29:01.552700 PM                         A
    1                        3/16/2010 12:29:01.552700 PM                         P
    1                        3/16/2010 12:19:01.552700 PM                         NIn my final query how can I get the row with seq_num 189 as it's the latest in Master table and from child table the row with status of P as it's the latest one based on the time. Here is the query i have but it returns the latest row from the child table only and basically repeats the master table rows as opposed to one row that is latest from both:
    Thanks

    Hi,
    You can use the analytic ROW_NUMKBER function to find the latest row for each cont_id in each table:
    WITH     got_m_rnum     AS
         SELECT     cont_id,     seq_num,     description
         ,     ROW_NUMBER () OVER ( PARTITION BY  cont_id
                                   ORDER BY          seq_num     DESC
                           ) AS m_rnum
         FROM    master_table
    --     WHERE     ...     -- any filtering goes here
    ,     got_c_rnum     AS
         SELECT     cont_id, updated_date,     status
         ,     ROW_NUMBER () OVER ( PARTITION BY  cont_id
                                   ORDER BY          updated_date     DESC
                           ) AS c_rnum
         FROM    child_table
    --     WHERE     ...     -- any filtering goes here
    SELECT     m.cont_id,     m.seq_num,     m.description
    ,     c.updated_date,     c.status
    FROM     got_m_rnum     m
    JOIN     got_c_rnum     c     ON     m.cont_id     = c.cont_id
                        AND     m.m_rnum     = c.c_rnum
                        AND     m.m_rnum     = 1
    ;If you'd like to post CREATE TABLE and INSERT statements for the sample data, then I could test this.
    If there happens to be a tie for the latest row (say, there are only two rows in the child_table with a certain cont_id, and both have exactly the same updated_date), then this query will arbitrarily choose one of them as the latest.

  • What is the latest update available for Mac OSX 10.5.8 that will allow me to get the latest update for iTunes.  I really need to update my iPhone and CAN'T!!  GRRRR!!!

    What is the latest update available for Mac OSX 10.5.8 that will allow me to get the latest update for iTunes.  I really need to update my iPhone and CAN'T!!  GRRRR!!!

    Minimally you need Snow Leopard or greater:
    Upgrade Paths to Snow Leopard, Lion, and/or Mountain Lion
    You can upgrade to Mountain Lion from Lion or directly from Snow Leopard. Mountain Lion can be downloaded from the Mac App Store for $19.99. To access the App Store you must have Snow Leopard 10.6.6 or later installed.
    Upgrading to Snow Leopard
    You can purchase Snow Leopard through the Apple Store: Mac OS X 10.6 Snow Leopard — Apple Store (U.S.). The price is $19.99 plus tax. You will be sent physical media by mail after placing your order.
    After you install Snow Leopard you will have to download and install the Mac OS X 10.6.8 Update Combo v1.1 to update Snow Leopard to 10.6.8 and give you access to the App Store. Access to the App Store enables you to download Mountain Lion if your computer meets the requirements.
         Snow Leopard General Requirements
           1. Mac computer with an Intel processor
           2. 1GB of memory
           3. 5GB of available disk space
           4. DVD drive for installation
           5. Some features require a compatible Internet service provider;
               fees may apply.
           6. Some features require Apple’s iCloud services; fees and
               terms apply.
    Upgrading to Lion
    If your computer does not meet the requirements to install Mountain Lion, it may still meet the requirements to install Lion.
    You can purchase Lion by contacting Customer Service: Contacting Apple for support and service — this includes international calling numbers. The cost is $19.99 (as it was before) plus tax.  It's a download. You will get an email containing a redemption code that you then use at the Mac App Store to download Lion. Save a copy of that installer to your Downloads folder because the installer deletes itself at the end of the installation.
         Lion System Requirements
           1. Mac computer with an Intel Core 2 Duo, Core i3, Core i5, Core i7,
               or Xeon processor
           2. 2GB of memory
           3. OS X v10.6.6 or later (v10.6.8 recommended)
           4. 7GB of available space
           5. Some features require an Apple ID; terms apply.
    Upgrading to Mountain Lion
    To upgrade to Mountain Lion you must have Snow Leopard 10.6.8 or Lion installed. Purchase and download Mountain Lion from the App Store. Sign in using your Apple ID. Mountain Lion is $19.99 plus tax. The file is quite large, over 4 GBs, so allow some time to download. It would be preferable to use Ethernet because it is nearly four times faster than wireless.
         OS X Mountain Lion — System Requirements
           Macs that can be upgraded to OS X Mountain Lion
             1. iMac (Mid 2007 or newer) — Model Identifier 7,1 or later
             2. MacBook (Late 2008 Aluminum, or Early 2009 or newer) —
                 Model Identifier 5,1 or later
             3. MacBook Pro (Mid/Late 2007 or newer) — Model Identifier 3,1 or later
             4. MacBook Air (Late 2008 or newer) — Model Identifier 2,1 or later
             5. Mac mini (Early 2009 or newer) — Model Identifier 3,1 or later
             6. Mac Pro (Early 2008 or newer) — Model Identifier 3,1 or later
             7. Xserve (Early 2009) — Model Identifier 3,1 or later
    To find the model identifier open System Profiler in the Utilities folder. It's displayed in the panel on the right.
    Are my applications compatible?
             See App Compatibility Table — RoaringApps.
         For a complete How-To introduction from Apple see Upgrade to OS X Mountain Lion.

  • Spatial Query to get the coodinates only

    Hi,
    I define an attribute called "geometry" in TILE table.
    For normal query (to get the tileId), I do the following (an example for illustration):
    SELECT tileId FROM tile
    WHERE SDO_RELATE(geometry, MDSYS.SDO_GEOMETRY(2003, 8307, NULL,
    MDSYS.SDO_ELEM_INFO_ARRAY(1, 1003, 1),
    MDSYS.SDO_ORDINATE_ARRAY(50,10, 70,10, 70,50, 50,50, 50,10)), 'mask=COVERS+CONTAINS+OVERLAPBDYINTERSECT+EQUAL querytype=WINDOW') = 'TRUE'
    ORDER BY tileid;
    If I do a query on geometry, I will get something like (select geometry from tile):
    SDO_GEOMETRY(2003, 8307, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1), SDO_ORDINATE_ARRAY(60, 60, 80, 60, 80, 80, 60, 80, 60, 60))
    How can I just get the result of (60, 60, 80, 60, 80, 80, 60, 80, 60, 60) ?
    Thanks for your advice!
    Message was edited by:
    eecow

    This should get you the results you need.
    select tileid, gv.x, gv.y from tile, table(sdo_util.getvertices(geom)) gv where sdo_relate etc etc etc
    Cheers,
    David

  • Query to get the Excise amount and basic amount based on the cst or vat tax

    Dear all,
                       I need a right query to get the basic amount ,excise amount and the tax amount based on the CST or VAT tax rate.The output should be like this,
    VAT
    goods excisabe at 1% - taxable amt(basic+excise for vat 1%)            tax amt
    goods excisable at 4%-   txable amt                                                       tax amt
    CST
    goods excisabe at 1% - taxable amt(basic+excise for CST 1%)            tax amt
    My problem will also be solved..if i am able to get  the basic value from base table OPCH itself............Since am using the PCH1 table to get the total basic amt...the values are duplicating.
    Regards,
    Shyam

    Hi Sowjanya,
    If you're simply trying to place a grand total, use the 'Insert Summary' option.
    Choose the measure field as the 'Field to Summarize' > Choose 'Sum' as the summary operation > Under 'Summary Location' choose 'Grand Total Report Footer'.
    -Abhilash

  • Query to get the hierarchical results

    Hi,
    Please help me in writing a Query to get the hierarchical results. I want a result like follows...
    course-----groupname---TotalMembers---NotStarted---INProgress---Completed
    Course1---country1--------12---------------6----------3-------------3
    Course1-----state11-------12---------------6----------3-------------3
    Course1------District111--10---------------5----------0-------------0
    Course1--------City1111----0---------------0----------0-------------0
    Course1--------City1112----1---------------0----------0-------------1
    Course1--------City1113----6---------------3----------2-------------1
    Course1---country2--------12---------------6----------3-------------3
    Course1----state21--------12---------------6----------3-------------3
    Course1------District211--10---------------5----------0-------------0
    Course1--------City2111----0---------------0----------0-------------0
    Course1--------City2112----1---------------0----------0-------------1
    Course1--------City2113----6---------------3----------2-------------1
    Course2---country1--------12---------------6----------2-------------3
    Course2----state11--------12---------------6----------2-------------3
    Course2------District111--10---------------5----------0-------------0
    Course2--------City1111----0---------------0----------0-------------0
    Course2--------City1112----1---------------0----------0-------------1
    Course2--------City1113----6---------------3----------1-------------2
    Course2---country2--------12---------------6----------3-------------3
    Course2-----state21-------12---------------6----------3-------------3
    Course2------District211--10---------------5----------0-------------0
    Course2--------City2111----0---------------0----------0-------------0
    Course2--------City2112----1---------------0----------0-------------1
    Course2--------City2113----6---------------3----------2-------------1
    These are the Tables available to me.
    (I have just given some examle data in tables, to get the idea)
    "Groups" Table (This table gives the information of the group)
    GROUPID-----NAME-------PARENTID
    1---------Universe--------1
    2---------country1--------1
    3---------state11---------2
    4---------District111-----3
    5---------City1111--------4
    6---------City1112--------4
    7---------City1113--------4
    8---------country2--------1
    9---------state21---------8
    10--------District211-----9
    11--------City2111--------10
    12--------City2112--------10
    13--------City2113--------10
    "Users" Table (This table provides the user information)
    userID----FIRSTNAME---LASTNAME
    user1-----------Jim-------Carry
    user2-----------Tom-------lee
    user3-----------sunny-----boo
    user4-----------mary------mall
    "User-Group" Tables (This table provides the relation between the groups
    and the members)
    GROUPID---userID
    3-------------user1
    3-------------user2
    3-------------user4
    4-------------user5
    5-------------user6
    5-------------user7
    user_score (This table provides the user scores of different courses)
    USERID----course-----STATUS
    user1------course1-----complete
    user1------course2-----NotStarted
    user2------course1-----NotStarted
    user2------course2-----complete
    user3------course1-----complete
    user3------course2-----InProgress
    user4------course2-----complete
    user4------course1-----NotStarted
    I will explain the first four lines of the above result.
    Course1---country1--------12---------------6----------4-------------2
    Course1-----state11-------12---------------6----------4-------------2
    Course1------District111--10---------------5----------3-------------2
    Course1--------City1111----0---------------0----------0-------------0
    Course1--------City1112----1---------------0----------0-------------1
    Course1--------City1113----6---------------3----------2-------------1
    # "city1111" group has 0 members
    # "city1112" group has 1 member (1 member completed the course1)
    # "city1113" group has 6 members(3 members notStarted,2 members
    InProgress,1 member completed the course1)
    # "District111" is the parent group of above three groups, and has 3
    members.(2 members NotStarted,1 member InProgress the course1). But this
    group has child groups, so the scores of this group has to rollup the
    child groups scores also. Thats why it has 2+3+0+0=6 members Not
    Started,1+2+0+0=3 members InProgress,0+0+1+1=2 members completed.
    # "state11" group also same as the above group.
    I am able to get the group hierarchy by using "Connect By" like follows
    "select name,groupid,parentid from groups_info start with groupid=1 connect by parentid = prior groupid;"
    But i want to get the result as i have mentioned in the begining of this discussion.
    I am using oracle 8i (oracle8.1.7).
    Thank you for any help
    Srinivas M

    This may not be exactly what you want,
    but it should be fairly close:
    SET      LINESIZE 100
    SET      PAGESIZE 24
    COLUMN   groupname FORMAT A20
    SELECT   INITCAP (user_score.course) "course",
             groupnames.name "groupname",
             COUNT (*) "TotalMembers",
             SUM (NVL (DECODE (UPPER (user_score.status), 'NOTSTARTED', 1), 0)) "NotStarted",
             SUM (NVL (DECODE (UPPER (user_score.status), 'INPROGRESS', 1), 0)) "InProgress",
             SUM (NVL (DECODE (UPPER (user_score.status), 'COMPLETE', 1), 0)) "Completed"
    FROM     user_score,
             user_group,
             (SELECT ROWNUM rn,
                     name,
                     groupid
              FROM   (SELECT     LPAD (' ', 2 * LEVEL - 2) || name AS name,
                                 groupid
                      FROM       groups
                      START WITH groupid = 1
                      CONNECT BY PRIOR groupid = parentid)) groupnames
    WHERE    user_score.userid = user_group.userid
    AND      user_group.groupid IN
             (SELECT     groupid
              FROM       groups
              START WITH groupid = groupnames.groupid
              CONNECT BY PRIOR groupid = parentid)
    GROUP BY user_score.course, groupnames.name, groupnames.rn
    ORDER BY user_score.course, groupnames.rn
    I entered the minimal test data that you
    provided and a bit more and got this result
    (It was formatted as you requested,
    but I don't know if it will display properly
    on this post, or wrap around):
    course  groupname            TotalMembers NotStarted InProgress  Completed
    Course1 Universe                        6          2          0          4
    Course1   country1                      5          2          0          3
    Course1     state11                     5          2          0          3
    Course1       District111               2          0          0          2
    Course1         City1112                1          0          0          1
    Course1         City1113                1          0          0          1
    Course1   country2                      1          0          0          1
    Course1     state21                     1          0          0          1
    Course1       District211               1          0          0          1
    Course1         City2113                1          0          0          1
    Course2 Universe                        5          1          1          3
    Course2   country1                      4          1          1          2
    Course2     state11                     4          1          1          2
    Course2       District111               1          0          1          0
    Course2         City1113                1          0          1          0
    Course2   country2                      1          0          0          1
    Course2     state21                     1          0          0          1
    Course2       District211               1          0          0          1
    Course2         City2113                1          0          0          1
    Here is the test data that I used, in case
    anyone else wants to play with it:
    create table groups
      (groupid  number,
       name     varchar2(15),
       parentid number)
    insert into groups
    values (1,'Universe',null)
    insert into groups
    values (2,'country1',1)
    insert into groups
    values (3,'state11',2)
    insert into groups
    values (4,'District111',3)
    insert into groups
    values (5,'City1111',4)
    insert into groups
    values (6,'City1112',4)
    insert into groups
    values (7,'City1113',4)
    insert into groups
    values (8,'country2',1)
    insert into groups
    values (9,'state21',8)
    insert into groups
    values (10,'District211',9)
    insert into groups
    values (11,'City2111',10)
    insert into groups
    values (12,'City2112',10)
    insert into groups
    values (13,'City2113',10)
    create table user_group
      (groupid number,
       userid  varchar2(5))
    insert into user_group
    values (3,'user1')
    insert into user_group
    values (3,'user2')
    insert into user_group
    values (3,'user4')
    insert into user_group
    values (4,'user5')
    insert into user_group
    values (5,'user6')
    insert into user_group
    values (5,'user7')
    insert into user_group
    values (7,'user8')
    insert into user_group
    values (13,'user9')
    insert into user_group
    values (11,'use11')
    insert into user_group
    values (6,'use6')
    create table user_score
      (userid varchar2(5),
       course varchar2(7),
       status varchar2(10))
    insert into user_score
    values ('use6','course1','complete')
    insert into user_score
    values ('user9','course1','complete')
    insert into user_score
    values ('user9','course2','complete')
    insert into user_score
    values ('user8','course1','complete')
    insert into user_score
    values ('user8','course2','InProgress')
    insert into user_score
    values ('user1','course1','complete')
    insert into user_score
    values ('user1','course2','NotStarted')
    insert into user_score
    values ('user2','course1','NotStarted')
    insert into user_score
    values ('user2','course2','complete')
    insert into user_score
    values ('user3','course1','complete')
    insert into user_score
    values ('user3','course2','InProgress')
    insert into user_score
    values ('user4','course2','complete')
    insert into user_score
    values ('user4','course1','NotStarted')

  • Query to get the customer's ship_to  Phone# and Fax#

    Gurus -
    Can anyone of you please help me in getting a query to shows the phoen and fax# of the Customer's ship_to Phone# and fax#
    customers--> on Address tab ( click open) On next screen click on contacts tabe for SHIP_TO row , there under the communications section, there are telephone and fax details , i want to get those details.
    Please help me in getting the query to get the fax and phone#.
    Infact I am using the below query and still having issues getting the correct fax# ( using teh same logic for phone#)
    select DISTINCT DECODE(PHONE_AREA_CODE,NULL,'',PHONE_AREA_CODE||'-')||PHONE_NUMBER
    FROM hz_cust_accounts_all hca,
    hz_parties hzp1,
    hz_cust_acct_sites_all hcas,
    hz_cust_site_uses_all hcsu,
    hz_relationships hzr,
    hz_org_contacts hoc,
    hz_contact_points hcp,
    hz_parties hzp,
    hz_cust_accounts_all hca1,
    hr_locations hrl
    WHERE 1 = 1
    AND hca.party_id = hzr.object_id
    AND hzr.relationship_id = hoc.party_relationship_id
    AND hoc.party_site_id = hcas.party_site_id
    AND hcas.cust_acct_site_id = hcsu.cust_acct_site_id
    AND hzr.party_id = hcp.owner_table_id
    --AND hcp.primary_flag = 'Y'
    AND hzr.subject_id = hzp.party_id
    AND hzp.party_id = hca1.party_id(+)
    AND hzp1.party_id(+) = hca.party_id
    AND hcsu.location = hrl.location_id(+)
    and hcsu.site_use_id = hsu.site_use_id
    AND hcp.OWNER_TABLE_NAME IN ('HZ_PARTIES')
    AND hcp.CONTACT_POINT_TYPE IN ('PHONE')
    AND hcp.PHONE_LINE_TYPE = 'FAX'
    AND hcp.STATUS = 'A'
    and nvl (hcsu.status, 'x') = 'A'
    AND hcsu.SITE_USE_CODE = 'SHIP_TO'
    --and hcsu.site_use_id = hsu.site_use_id
    -- and hcsu.cust_acct_site_id = hsu.cust_acct_site_id
    --and hca1.cust_account_id = hca.cust_account_id                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    What is the responsibility name? Form name and navigation path?
    You can determine the query from the form itself as follows:
    - Query the record(s)
    - Click on Help > Diagnostics > Examine
    - Under 'Block' field, select 'SYSTEM'
    - Under 'Field' field, select 'LAST_QUERY'
    You may also review the following note:
    Note: 259722.1 - HOWTO Determine Table and Column Name from a field in a form in 11i
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=259722.1

  • SQL query to get the list of approvals

    Hi,
    Could someone let me know the SQL query to get the list of all the pending approvals for a user in OIM 11g R2.
    Thanks

    There are a few ways to do this:
    -  The easiest would be to use a Relationship Query from the CMC. To do this, go to the Universes section on the CMC, right click on the relevant universe, select tools >> Check Relationships.
    - Use Query Builder. You will need more than one query to pull the information you need. You could try something like the below (for Webi)
    SELECT SI_NAME, SI_WEBI, SI_DATACONNECTION FROM CI_APPOBJECTS
    WHERE SI_KIND = 'universe' and SI_NAME = 'Universe Name'
    This will give you a list of Webi Reports by SI_ID.
    You'll need another query to list Webi report names:
    SELECT SI_NAME FROM CI_INFOOBJECTS WHERE SI_ID IN (SI_ID from query above)
    - This is trivial via Auditing / the Activity universe. This of course will only return reports that have already run.
    Best.
    Srinivas

Maybe you are looking for

  • OdbcDataAdapter.Fill() not getting all rows from RDB using 64bit driver

    I am using VS2012 Pro on Windows 7 (64-bit). I am migrating an older 32-bit VS2008 app to the new environment. I'm building for the .NET Framework 4.5. The app queries an RDB database and uses the Oracle RDB drivers version 3.3.2.0. When I build as a

  • Migration Assistant- Recovering from a hard disk failure

    Was running on OS X 10.8.5 on MBP 8,3 (2011 17") Many issues with slowness, and software, and then boom, the hard disk failed. No software recovery worked.  Drive has been shipped for physical recovery. I did not use migration assistant to set up the

  • Display same data on 2 regions of the SAME Page

    Hi I have 2 regions.Top is an interactive editable report.Bottom region is a read only report of the same(top region) But when i click search button(based on paramters 1&2, i am not able to see the same number of rows. Top region shows 5 like emp id

  • How to apply input file name to output file in file adapter

    Hi Friends In my file to file scenario,i want to use input file name to output file by using adapter specific attributes,for this i have java code.Please suggest me how can i use this java code in mesg mapping and to which field i need to mapping thi

  • To create report EWA

    Good days the motive of my doubt is like to create a report EWA in the solman to extract a few monthly reports and if there is a note sap where I can find realize it like. Marcos A. Monzón