Help in query to get the max(date)

Hi I have query like below and based on the query I get the following results,
SELECT a.UsageId,a.product,ProductDate
FROM dbo.table1 a
JOIN dbo.table2 b ON a.SID= b.SID
JOIN dbo.table3 c ON b.CID = c.CID
UsageId        Product          UsageDate
1 Yellow 2014-01-01
2 Yellow 2014-01-02
3 Yellow 2014-01-03
4 Yellow 2014-01-04
5 Red 2014-01-01
6 Red 2014-01-02
7 Blue 2014-01-03
8 Blue
2014-01-04
Now I want to add a new column which gives me the Max(UsageDate) of the column Prdouct last Usage.
UsageId        Product          UsageDate          Max(UsageDate)
1 Yellow
2014-01-01          2014-01-04
2 Yellow
2014-01-02    2014-01-04
3 Yellow
2014-01-03          2014-01-04
4 Yellow
2014-01-04          2014-01-04
5 Red 2014-01-01          2014-01-02 
6 Red 2014-01-02          2014-01-02
7 Blue
2014-01-03          2014-01-04
8 Blue
2014-01-04          2014-01-04

Simply use:
SELECT a.UsageId,a.product,ProductDate, MAX(ProductDate) OVER (PARTITION BY a.ProductID) as [Latest Product Usage Date]
FROM dbo.table1 a
JOIN dbo.table2 b ON a.SID= b.SID
JOIN dbo.table3 c ON b.CID = c.CID
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articles

Similar Messages

  • Can I get a query to get the output data like 4th column instead of 3rd col

    Can I get a query to get the output data like 4th column instead of 3rd column ?
    SQL> select emp.deptno, empno, rownum from emp, dept where emp.deptno=dept.deptno;
    DEPTNO EMPNO ROWNUM
    10 7782 *1* *1*
    10 7839 *2* *2*
    10 7934 *3* *3*
    20 7369 *4* *1*
    20 7876 *5* *2*
    20 7902 *6* *3*
    20 7788 *7* *4*
    20 7566 *8* *5*
    30 7499 *9* *1*
    30 7698 *10* *2*
    30 7654 *11* *3*
    30 7900 *12* *4*
    30 7844 *13* *5*
    30 7521 *14* *6*
    14 rows selected.

    SQL> select emp.deptno, emp.empno,
      2    row_number() over(order by emp.deptno, emp.empno) rn,
      3    row_number() over(partition by emp.deptno order by emp.empno) dept_rn
      4  from emp, dept
      5  where emp.deptno=dept.deptno
      6  order by emp.deptno, emp.empno;
        DEPTNO      EMPNO         RN    DEPT_RN
            10       7782          1          1
            10       7839          2          2
            10       7934          3          3
            20       7369          4          1
            20       7566          5          2
            20       7788          6          3
            20       7876          7          4
            20       7902          8          5
            30       7499          9          1
            30       7521         10          2
            30       7654         11          3
            30       7698         12          4
            30       7844         13          5
            30       7900         14          6
    14 rows selected.Regards,
    Dima

  • Query to fetch the max date

    Hi All,
    Taking the below data as sample,we have a requirement wherein we have to fetch the date based on the following criteria.
    Item     Cost     Transaction Date
    A     23     12-feb-2012 1:00 AM
    P     23     12-feb-2012 2:00 AM
    B     24     13-feb-2012
    C     43     14-feb-2012 3:00 AM
    M     43     14-feb-2012 8:00 AM
    D     12     16-feb-2012
    User will pass date as the parameter and if the table has Transaction Date same as the date parameter then that date is picked.
    Eg: if the parameter passed is 12-feb-2012, since it is present in table then 12-Feb-2012 2:00AM will be fetched. The table has 2 records, the onewith latest date is picked.
    Now if the table does not have Transaction Date same as the date parameter then the max date previous to that date passed as parameter should be picked.
    Eg: if the parameter passed is 15-feb-2012, since 15- FEB-2012 is not present in table, it should pick 14-FEB-2012 8:00 AM (latest date).
    I am not able to frame queries for the above criteria.
    If someone can help me with the same, it would be of great help.
    Regards,
    Shruti

    Hi, Shruti,
    this does waht you requested:
    SELECT     MAX (transaction_date)     AS max_transaction_date
    FROM     table_x
    WHERE     transaction_date < TO_DATE ( :given_date
                              , 'DD-Mon-YYYY'
                           ) + 1
    ;where :given_date is a string, such as '12-feb-2012'.
    Since the call to TO_DATE doesn't specify hours, minutes or seconds, they will befault to 00:00:00, so '12-feb-1012' would mean mignight at the beginning of February 12. We want it to mean anything later on the same day; that's why I added 1 to the date, and used < instead of <=.
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using.
    See the forum FAQ {message:id=9360002}

  • Query to get the max of date wrt to name

    i want to retrive the maximum of the ACT_START_TM column with respect to the name
    SQL> SELECT  c.NAME NAME,
      2              d.INAME INAME,
      3              d.M MNAME,
      4              d.PNAME PNAME,
      5              (TO_CHAR(d.ACT_START_DT_TM,'YYYY-MM-DD HH24:MI:SS')) ACT_START_TM
      6              from INS d, INSDETAIL c
      7              where C.TNAME IN('NULLTEST1','NULLTEST2','NULLTEST3','NULLTEST4'
      8                          ) AND
      9                  c.NAME = d.INSTRCTN_NAME AND d.TYP || '' = 'I'
    10                  AND d.ACT_START_DT is not null
    11                  AND d.ACT_START_DT < sysdate-2
    12              ORDER BY ACT_START_TM DESC,TNAME DESC, INAME   DESC;
    NAME                    INAME                  MNAME                                                                   PNAME          ACT_START_TM
    NULLTEST4       OI-TEST-1LEV1-0012   MODE-1-OF-1-LEVEL-EQUIPMENT-OF-1O-LVL-HI           HYDROGEN     2011-11-19 17:52:00
    NULLTEST3       OI-TEST-1LEV1-0012   MODE-1-OF-1-LEVEL-EQUIPMENT-OF-1O-LVL-HI           HYDROGEN     2011-11-19 17:52:00
    NULLTEST2       OI-TEST-1LEV1-0012   MODE-1-OF-1-LEVEL-EQUIPMENT-OF-1O-LVL-HI           HYDROGEN     2011-11-19 17:52:00
    NULLTEST1       OI-TEST-1LEV1-0012   MODE-1-OF-1-LEVEL-EQUIPMENT-OF-1O-LVL-HI           HYDROGEN     2011-11-19 17:52:00
    NULLTEST4       OI-TEST-1LEV1-0011   MODE-1-OF-1-LEVEL-EQUIPMENT-OF-1O-LVL-HI           HYDROGEN     2011-11-19 13:52:00
    NULLTEST3       OI-TEST-1LEV1-0011   MODE-1-OF-1-LEVEL-EQUIPMENT-OF-1O-LVL-HI           HYDROGEN     2011-11-19 13:52:00
    NULLTEST2       OI-TEST-1LEV1-0011   MODE-1-OF-1-LEVEL-EQUIPMENT-OF-1O-LVL-HI           HYDROGEN     2011-11-19 13:52:00
    NULLTEST1       OI-TEST-1LEV1-0011   MODE-1-OF-1-LEVEL-EQUIPMENT-OF-1O-LVL-HI           HYDROGEN     2011-11-19 13:52:00
    NULLTEST4       OI-TEST-1LEV1-0009   MODE-1-OF-1-LEVEL-EQUIPMENT-OF-1O-LVL-HI           HYDROGEN     2011-09-17 12:43:00
    NULLTEST3       OI-TEST-1LEV1-0009   MODE-1-OF-1-LEVEL-EQUIPMENT-OF-1O-LVL-HI           HYDROGEN     2011-09-17 12:43:00
    NULLTEST2       OI-TEST-1LEV1-0009   MODE-1-OF-1-LEVEL-EQUIPMENT-OF-1O-LVL-HI           HYDROGEN     2011-09-17 12:43:00
    NULLTEST1       OI-TEST-1LEV1-0009   MODE-1-OF-1-LEVEL-EQUIPMENT-OF-1O-LVL-HI           HYDROGEN     2011-09-17 12:43:00
    12 rows selected.

    hi
    iam using the ran function inside a cursor,
    iam getting the below error while compilation.
    procedure fetchinstrinfo ( mindate in varchar2,instrinfo in out RefCursor_fetchinstrinfo)
    as
    begin
    open instrinfo
    for
    (select name,iname,mname,pname,act_start_tm
       from (
          select c.name name,
              d.iname iname,
              d.m mname,
              d.pname pname,
              (to_char(d.act_start_dt_tm,'yyyy-mm-dd hh24:mi:ss')) act_start_tm,
              row_number() over(partition by c.name order by d.act_start_dt_tm desc) rno
            from ins d, insdetail c
           where c.tname in('NULLTEST1','NULLTEST2','NULLTEST3','NULLTEST4')
             and c.name = d.instrctn_name and d.typ || '' = 'I'
             and d.act_start_dt is not null
             and d.act_start_dt < mindate
      where rno = 1
    UNION
    ( select c.name name,
              d.iname iname,
              d.m mname,
              d.pname pname,
              (to_char(d.act_start_dt_tm,'yyyy-mm-dd hh24:mi:ss')) act_start_tm,
              row_number() over(partition by c.name order by d.act_start_dt_tm desc) rno
            from ins d, insdetail c
           where c.tname in('NULLTEST1','NULLTEST2','NULLTEST3','NULLTEST4')
             and c.name = d.instrctn_name and d.typ || '' = 'I'
             and d.act_start_dt is not null
             and d.act_start_dt <mindate)
    ORDER BY ACT_START_DT_TM DESC,TRGT_NAME DESC, INSTRCTN_NAME   DESC;
    end fetchinstrinfo;
    errors:
    PLS-00103: Encountered the symbol "SELECT" when expecting one of the following:
       ( - + case mod new not null <an identifier>
       <a double-quoted delimited-identifier> <a bind variable>
       continue
    PLS-00103: Encountered the symbol "(" when expecting one of the following:
       , from

  • Mdx query to get the last date of every month if the month is current month need current date..

    i have a scenario where i need the data of last date of every month and if the month is current month need current date data...
    is it possible using MDX...

    Hi Shashi,
    According to your description, you want to return the last day for each month except current month, right?
    In MDX, we can use ClosingPeriod function to return the member that is the last sibling among the descendants of a specified member at a specified level, here is a sample query for you reference.
    with member [measures].[a]
    as
    ClosingPeriod ([Date].[Calendar].[Date],[Date].[Calendar].currentmember).name
    select {[measures].[a]} on 0,
    [Date].[Calendar].[Month].members on 1
    from
    [Adventure Works]
    And then use the IIF function to evaluate if the month is current month. Please refer to the links below.
    http://msdn.microsoft.com/en-us/library/ms145584.aspxhttp://msdn.microsoft.com/en-IN/library/ms145994.aspx
    Regards,
    Charlie Liao
    TechNet Community Support

  • How to retreive the max data length of a column

    Hello All,
    I know how to do a select to get the max data length of a column it is this :
    SELECT MAX(LENGTH(COLUMN_NAME) FROM table.
    However, I need this information combined with my SQL that returns the Data_type and length from the USER_TAB_COLUMNS. So taking the emp example if the ename column was 50 as VARCHAR2 but the max data entered in it was just 20 I want the information like this:
    SELECT COLUMN_NAME, DATA_LENGTH, and the Max length of 20
    FROM USER_TAB_COLUMNS WHERE TABLE_NAME='EMP';
    I don't know how to get the Max Length of the Column in this table. Can anyone suggest me a hint? An Inline view maybe?
    Thanks

    Still not sure about your requirements, but how about this
    SQL> CREATE OR REPLACE FUNCTION get_max_length(p_table in varchar2, p_col in varchar2) return pls_integer
      2  is
      3    v_cnt pls_integer;
      4  begin
      5    execute immediate 'select max(length('||p_col||')) from '||p_table into v_cnt;
      6    return v_cnt;
      7  end get_max_length;
      8  /
    Function created.
    SQL>
    SQL> SELECT COLUMN_NAME,
      2         DATA_LENGTH,
      3         get_max_length(TABLE_NAME, COLUMN_NAME) max_length
      4  FROM USER_TAB_COLUMNS
      5  WHERE TABLE_NAME='EMP'
      6  AND DATA_TYPE like '%CHAR%'
      7  ;
    COLUMN_NAME                    DATA_LENGTH MAX_LENGTH
    ENAME                                   10          6
    JOB                                      9          9
    SQL>

  • I want the max date but only look at rows with a certain category value.

    I want a way to get the max date but only look at rows with a certain category value - ignoring the other rows.  My detail table contains expenditures including date (col A) and category (col D) the number of rows will increase with expenditures over time.  My summary table will have a cell for each category and display the last expense date for that category using a functionality that I must ask of you, dear community.
    I am using the latest numbers on an iPad (4) with IOS6.
    Secondarily, I would like to add another cell in the summery table with the value (col E) of the last expense for each category.
    Thank you,
    Warren

    ...later...
    With the addition of an auxiliary column to the Main table, a second header row to the Most recent table, and a minor modification to the formula on the second table, the tables can handle a range of dates set by entering the first and last date into A1 abd B1 respectively of the summary table, Most recent.
    Note that the selected range, shown with a green background in the auxiliary column, does not contain any category B expenses. Using LOOKUP, this would result in a repeat of the January 6 expense bering listed in this row. Switching to VLOOKUP, which can be set to require an exact match, allows the result shown—if there are no expenses in a given category, the formula returns "none" (or whatever message you substitute for "none" in the formula in that column).
    Formulas:
    Main::A2: =IF(OR(B<Most recent :: $A$1,B>Most recent :: $B$1),"x"&E,E)
    Fill down to the end of column A.
    This column must be located on the left side of the table (ie. must be column A), but may be hidden.
    Most recent::A2: =IFERROR(VLOOKUP($D,Main :: $A:$D,COLUMN()+1,FALSE),"none")
    "FALSE" will display as "Exact match" in Numbers's formula editor.
    Fill down to the end of the table and right to column C.
    Regards,
    Barry

  • Query - Filter by a specific dynamic date - Return only the max date record

    Hello experts,
    I'm building a query. In this query I have a filter named validity date. I need to select a record where the max date is less than this filter.
    For example:
    Comp. Code | Plant | Mat. | Cost Type | Valid. Date | Value
    0000000001   00001  0001  xxxxxxxx    12.05.2008   2,00
    0000000001   00001  0001  xxxxxxxx    09.05.2008   1,00
    0000000001   00001  0001  xxxxxxxx    05.05.2008   0,50
    If the user set 13.05.2008 in the filter, the report should return:
    0000000001   00001  0001  xxxxxxxx    12.05.2008   2,00
    If the user set 11.05.2008 in the filter, the report should return:
    0000000001   00001  0001  xxxxxxxx    09.05.2008   1,00
    If the user set 08.05.2008 in the filter, the report should return:
    0000000001   00001  0001  xxxxxxxx    05.05.2008   0,50
    The problem is that the date will be dynamic and I'll need to return just one line for a combination of Company Code, Plant, Material and Cost Type. First of all I would like to know the best way to do it. Do I need to use virtual key figure? If so, anyone could tell me some steps to do it?
    Thanks in advance,
    Helder

    Not Virtual KeyFigure.
    You can achieve this with Restricted KeyFigure with the restriction with CalDay (Variable) which user input while Running the Query. Its more like a Bucket. SAP Delivered Buckets Query is in the below link. Check that query you will understand better about Bucket.
    http://help.sap.com/saphelp_nw04/helpdata/en/40/94af39a3488979e10000000a11402f/content.htm
    If not clear try to Install the BC Query and play with that you will know better.
    Thanks
    Sriram

  • 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>

  • Hi, can you help?  My emails that I have received show the date received as either today, yesterday or July 28.  How can I get the correct date received?

    Hi, The emails that I have received show the date received as either today, yesterday or July 28.  How can I get the correct date received?

    That's very scary. They might do it, but I personally have never had Apple contact me re id's except on their site when signing in. I suggest you DO NOT respond until you have a phone conversation with Apple security. They can verify if they sent you the e-mail and why.
    While it's very possible it's true,again, I suggest you not respond until you speak to someone at Apple. I've often read here that when people sign in they are not allowed to because "someone else has used the id" type of statement.
    Also, you should be able to go to the app store and see what apps you have downloaded.
    Though it could have been a free app, have you checked to see if any were bought with your id account?
    I've gotten these types of e-mails from places like USPS and FedEx which look amazingly authentic and were from their website. I also received an odd e-mail from my cousin in Ireland last year that clearly was not from him. It was also sent to others in his family in Ireland. I e-mailed him that I only opened it because it had a .ie, but suggested he change... Days later I received mail from 'him' - same name, but at yahoo.com. 
    Again, I would call Apple. You can also report it at [email protected], but I would not settle for that given your situation. If nothing else, call Apple sales (sales depts. anywhere answer fast) and ask them to transfer you to security. Apple will not want anybody accessing their name, and while it's unlikely, it's not impossible that it is someone phishing.
    Hope this helps and can you let the support community know your results by posting on this thread when you're done? Thank you.
    Hope this helps.

  • Please help.........how can i get the last date of the month?????

    Hello....
    I want to get the last date of the month.
    For example, the last date of Jan is 31.
    How can I get the last date of the particular month and year ????
    Thanks for help.
    Gloria

    Hi Gloria
    1. How can I compare the date???date1.compareTo(date2)
    where date1 and date2 is a java.util.Date Object
    will return 0 if it is the same date
    or
    date1.after(date2)
    where date1 and date2 is a java.util.Date Object
    will return true if date1 is after date2
    (the same for date1.before)
    2. How can I change the date format into yyyymmdd format???? I just want the year, month and date.try the java.text.SimpleDateFormat Object
    new SimpleDateFormat("yyyymmdd").format(yourdate)
    Hope this help.
    Please also have a look at a calendar I wrote, (maybe it help)
    demo & source :
    http://www.geocities.com/globe_software/java/components/
    globe_sa

  • Query to get the current DB date, not server date

    Hi,
    We have few DB in one server, but each DB have different timezone.
    How can I get the query to generate the current date in each DB?
    Thanks

    Hi,
    Try this query:
    SELECT DB_NAME() AS DataBaseName,getdate()
    Thanks & Regards,
    Nagarajan

  • How to find the max data transfer rate(disk speed) supported by mobo?

    I plan on replacing my current HDD with a new and bigger HDD.
    For this I need to know the max data transfer rate(disk speed) that my mobo will support. However, dmidecode is not telling me that. Am I missing something?
    Here's dmidecode:
    # dmidecode 2.11
    SMBIOS 2.5 present.
    80 structures occupying 2858 bytes.
    Table at 0x000F0450.
    Handle 0xDA00, DMI type 218, 101 bytes
    OEM-specific Type
    Header and Data:
    DA 65 00 DA B2 00 17 4B 0E 38 00 00 80 00 80 01
    00 02 80 02 80 01 00 00 A0 00 A0 01 00 58 00 58
    00 01 00 59 00 59 00 01 00 75 01 75 01 01 00 76
    01 76 01 01 00 05 80 05 80 01 00 D1 01 19 00 01
    00 15 02 19 00 02 00 1B 00 19 00 03 00 19 00 19
    00 00 00 4A 02 4A 02 01 00 0C 80 0C 80 01 00 FF
    FF 00 00 00 00
    Handle 0xDA01, DMI type 218, 35 bytes
    OEM-specific Type
    Header and Data:
    DA 23 01 DA B2 00 17 4B 0E 38 00 10 F5 10 F5 00
    00 11 F5 11 F5 00 00 12 F5 12 F5 00 00 FF FF 00
    00 00 00
    Handle 0x0000, DMI type 0, 24 bytes
    BIOS Information
    Vendor: Dell Inc.
    Version: A17
    Release Date: 04/06/2010
    Address: 0xF0000
    Runtime Size: 64 kB
    ROM Size: 4096 kB
    Characteristics:
    PCI is supported
    PNP is supported
    APM is supported
    BIOS is upgradeable
    BIOS shadowing is allowed
    ESCD support is available
    Boot from CD is supported
    Selectable boot is supported
    EDD is supported
    Japanese floppy for Toshiba 1.2 MB is supported (int 13h)
    3.5"/720 kB floppy services are supported (int 13h)
    Print screen service is supported (int 5h)
    8042 keyboard services are supported (int 9h)
    Serial services are supported (int 14h)
    Printer services are supported (int 17h)
    ACPI is supported
    USB legacy is supported
    BIOS boot specification is supported
    Function key-initiated network boot is supported
    Targeted content distribution is supported
    BIOS Revision: 17.0
    Handle 0x0100, DMI type 1, 27 bytes
    System Information
    Manufacturer: Dell Inc.
    Product Name: OptiPlex 755
    Version: Not Specified
    UUID: 44454C4C-5900-1050-8033-C4C04F434731
    Wake-up Type: Power Switch
    SKU Number: Not Specified
    Family: Not Specified
    Handle 0x0200, DMI type 2, 8 bytes
    Base Board Information
    Manufacturer: Dell Inc.
    Product Name: 0PU052
    Version:
    Handle 0x0300, DMI type 3, 13 bytes
    Chassis Information
    Manufacturer: Dell Inc.
    Type: Space-saving
    Lock: Not Present
    Version: Not Specified
    Asset Tag:
    Boot-up State: Safe
    Power Supply State: Safe
    Thermal State: Safe
    Security Status: None
    Handle 0x0400, DMI type 4, 40 bytes
    Processor Information
    Socket Designation: CPU
    Type: Central Processor
    Family: Xeon
    Manufacturer: Intel
    ID: 76 06 01 00 FF FB EB BF
    Signature: Type 0, Family 6, Model 23, Stepping 6
    Flags:
    FPU (Floating-point unit on-chip)
    VME (Virtual mode extension)
    DE (Debugging extension)
    PSE (Page size extension)
    TSC (Time stamp counter)
    MSR (Model specific registers)
    PAE (Physical address extension)
    MCE (Machine check exception)
    CX8 (CMPXCHG8 instruction supported)
    APIC (On-chip APIC hardware supported)
    SEP (Fast system call)
    MTRR (Memory type range registers)
    PGE (Page global enable)
    MCA (Machine check architecture)
    CMOV (Conditional move instruction supported)
    PAT (Page attribute table)
    PSE-36 (36-bit page size extension)
    CLFSH (CLFLUSH instruction supported)
    DS (Debug store)
    ACPI (ACPI supported)
    MMX (MMX technology supported)
    FXSR (FXSAVE and FXSTOR instructions supported)
    SSE (Streaming SIMD extensions)
    SSE2 (Streaming SIMD extensions 2)
    SS (Self-snoop)
    HTT (Multi-threading)
    TM (Thermal monitor supported)
    PBE (Pending break enabled)
    Version: Not Specified
    Voltage: 0.0 V
    External Clock: 1333 MHz
    Max Speed: 5200 MHz
    Current Speed: 2666 MHz
    Status: Populated, Enabled
    Upgrade: Socket LGA775
    L1 Cache Handle: 0x0700
    L2 Cache Handle: 0x0701
    L3 Cache Handle: Not Provided
    Serial Number: Not Specified
    Asset Tag: Not Specified
    Part Number: Not Specified
    Core Count: 2
    Core Enabled: 2
    Thread Count: 2
    Characteristics:
    64-bit capable
    Handle 0x0700, DMI type 7, 19 bytes
    Cache Information
    Socket Designation: Not Specified
    Configuration: Enabled, Not Socketed, Level 1
    Operational Mode: Write Back
    Location: Internal
    Installed Size: 32 kB
    Maximum Size: 32 kB
    Supported SRAM Types:
    Other
    Installed SRAM Type: Other
    Speed: Unknown
    Error Correction Type: None
    System Type: Data
    Associativity: 8-way Set-associative
    Handle 0x0701, DMI type 7, 19 bytes
    Cache Information
    Socket Designation: Not Specified
    Configuration: Enabled, Not Socketed, Level 2
    Operational Mode: Varies With Memory Address
    Location: Internal
    Installed Size: 6144 kB
    Maximum Size: 6144 kB
    Supported SRAM Types:
    Other
    Installed SRAM Type: Other
    Speed: Unknown
    Error Correction Type: Single-bit ECC
    System Type: Unified
    Associativity: <OUT OF SPEC>
    Handle 0x0800, DMI type 8, 9 bytes
    Port Connector Information
    Internal Reference Designator: PARALLEL
    Internal Connector Type: None
    External Reference Designator: Not Specified
    External Connector Type: DB-25 female
    Port Type: Parallel Port PS/2
    Handle 0x0801, DMI type 8, 9 bytes
    Port Connector Information
    Internal Reference Designator: SERIAL1
    Internal Connector Type: None
    External Reference Designator: Not Specified
    External Connector Type: DB-9 male
    Port Type: Serial Port 16550A Compatible
    Handle 0x0802, DMI type 126, 9 bytes
    Inactive
    Handle 0x0803, DMI type 126, 9 bytes
    Inactive
    Handle 0x0804, DMI type 126, 9 bytes
    Inactive
    Handle 0x0805, DMI type 8, 9 bytes
    Port Connector Information
    Internal Reference Designator: USB1
    Internal Connector Type: None
    External Reference Designator: Not Specified
    External Connector Type: Access Bus (USB)
    Port Type: USB
    Handle 0x0806, DMI type 8, 9 bytes
    Port Connector Information
    Internal Reference Designator: USB2
    Internal Connector Type: None
    External Reference Designator: Not Specified
    External Connector Type: Access Bus (USB)
    Port Type: USB
    Handle 0x0807, DMI type 8, 9 bytes
    Port Connector Information
    Internal Reference Designator: USB3
    Internal Connector Type: None
    External Reference Designator: Not Specified
    External Connector Type: Access Bus (USB)
    Port Type: USB
    Handle 0x0808, DMI type 8, 9 bytes
    Port Connector Information
    Internal Reference Designator: USB4
    Internal Connector Type: None
    External Reference Designator: Not Specified
    External Connector Type: Access Bus (USB)
    Port Type: USB
    Handle 0x0809, DMI type 8, 9 bytes
    Port Connector Information
    Internal Reference Designator: USB5
    Internal Connector Type: None
    External Reference Designator: Not Specified
    External Connector Type: Access Bus (USB)
    Port Type: USB
    Handle 0x080A, DMI type 8, 9 bytes
    Port Connector Information
    Internal Reference Designator: USB6
    Internal Connector Type: None
    External Reference Designator: Not Specified
    External Connector Type: Access Bus (USB)
    Port Type: USB
    Handle 0x080B, DMI type 8, 9 bytes
    Port Connector Information
    Internal Reference Designator: USB7
    Internal Connector Type: None
    External Reference Designator: Not Specified
    External Connector Type: Access Bus (USB)
    Port Type: USB
    Handle 0x080C, DMI type 8, 9 bytes
    Port Connector Information
    Internal Reference Designator: USB8
    Internal Connector Type: None
    External Reference Designator: Not Specified
    External Connector Type: Access Bus (USB)
    Port Type: USB
    Handle 0x080D, DMI type 8, 9 bytes
    Port Connector Information
    Internal Reference Designator: ENET
    Internal Connector Type: None
    External Reference Designator: Not Specified
    External Connector Type: RJ-45
    Port Type: Network Port
    Handle 0x080E, DMI type 8, 9 bytes
    Port Connector Information
    Internal Reference Designator: MIC
    Internal Connector Type: None
    External Reference Designator: Not Specified
    External Connector Type: Mini Jack (headphones)
    Port Type: Audio Port
    Handle 0x080F, DMI type 8, 9 bytes
    Port Connector Information
    Internal Reference Designator: LINE-OUT
    Internal Connector Type: None
    External Reference Designator: Not Specified
    External Connector Type: Mini Jack (headphones)
    Port Type: Audio Port
    Handle 0x0810, DMI type 8, 9 bytes
    Port Connector Information
    Internal Reference Designator: LINE-IN
    Internal Connector Type: None
    External Reference Designator: Not Specified
    External Connector Type: Mini Jack (headphones)
    Port Type: Audio Port
    Handle 0x0811, DMI type 8, 9 bytes
    Port Connector Information
    Internal Reference Designator: HP-OUT
    Internal Connector Type: None
    External Reference Designator: Not Specified
    External Connector Type: Mini Jack (headphones)
    Port Type: Audio Port
    Handle 0x0812, DMI type 8, 9 bytes
    Port Connector Information
    Internal Reference Designator: MONITOR
    Internal Connector Type: None
    External Reference Designator: Not Specified
    External Connector Type: DB-15 female
    Port Type: Video Port
    Handle 0x090A, DMI type 9, 13 bytes
    System Slot Information
    Designation: SLOT1
    Type: x1 Proprietary
    Current Usage: In Use
    Length: Long
    Characteristics:
    PME signal is supported
    Handle 0x0901, DMI type 126, 13 bytes
    Inactive
    Handle 0x0902, DMI type 9, 13 bytes
    System Slot Information
    Designation: SLOT2
    Type: 32-bit PCI
    Current Usage: Available
    Length: Long
    ID: 2
    Characteristics:
    5.0 V is provided
    3.3 V is provided
    PME signal is supported
    Handle 0x0903, DMI type 126, 13 bytes
    Inactive
    Handle 0x0904, DMI type 126, 13 bytes
    Inactive
    Handle 0x0905, DMI type 126, 13 bytes
    Inactive
    Handle 0x0906, DMI type 126, 13 bytes
    Inactive
    Handle 0x0907, DMI type 126, 13 bytes
    Inactive
    Handle 0x0908, DMI type 126, 13 bytes
    Inactive
    Handle 0x0A00, DMI type 10, 6 bytes
    On Board Device Information
    Type: Video
    Status: Disabled
    Description: Intel Graphics Media Accelerator 950
    Handle 0x0A02, DMI type 10, 6 bytes
    On Board Device Information
    Type: Ethernet
    Status: Enabled
    Description: Intel Gigabit Ethernet Controller
    Handle 0x0A03, DMI type 10, 6 bytes
    On Board Device Information
    Type: Sound
    Status: Enabled
    Description: Intel(R) High Definition Audio Controller
    Handle 0x0B00, DMI type 11, 5 bytes
    OEM Strings
    String 1: www.dell.com
    Handle 0x0D00, DMI type 13, 22 bytes
    BIOS Language Information
    Language Description Format: Long
    Installable Languages: 1
    en|US|iso8859-1
    Currently Installed Language: en|US|iso8859-1
    Handle 0x0F00, DMI type 15, 29 bytes
    System Event Log
    Area Length: 2049 bytes
    Header Start Offset: 0x0000
    Header Length: 16 bytes
    Data Start Offset: 0x0010
    Access Method: Memory-mapped physical 32-bit address
    Access Address: 0xFFF01000
    Status: Valid, Not Full
    Change Token: 0x00000018
    Header Format: Type 1
    Supported Log Type Descriptors: 3
    Descriptor 1: POST error
    Data Format 1: POST results bitmap
    Descriptor 2: System limit exceeded
    Data Format 2: System management
    Descriptor 3: Log area reset/cleared
    Data Format 3: None
    Handle 0x1000, DMI type 16, 15 bytes
    Physical Memory Array
    Location: System Board Or Motherboard
    Use: System Memory
    Error Correction Type: None
    Maximum Capacity: 8 GB
    Error Information Handle: Not Provided
    Number Of Devices: 4
    Handle 0x1100, DMI type 17, 27 bytes
    Memory Device
    Array Handle: 0x1000
    Error Information Handle: Not Provided
    Total Width: 64 bits
    Data Width: 64 bits
    Size: 1024 MB
    Form Factor: DIMM
    Set: None
    Locator: DIMM_1
    Bank Locator: Not Specified
    Type: DDR2
    Type Detail: Synchronous
    Speed: 667 MHz
    Manufacturer: AD00000000000000
    Handle 0x1101, DMI type 17, 27 bytes
    Memory Device
    Array Handle: 0x1000
    Error Information Handle: Not Provided
    Total Width: 64 bits
    Data Width: 64 bits
    Size: 1024 MB
    Form Factor: DIMM
    Set: None
    Locator: DIMM_3
    Bank Locator: Not Specified
    Type: DDR2
    Type Detail: Synchronous
    Speed: 667 MHz
    Handle 0x1102, DMI type 17, 27 bytes
    Memory Device
    Array Handle: 0x1000
    Error Information Handle: Not Provided
    Total Width: 64 bits
    Data Width: 64 bits
    Size: 1024 MB
    Form Factor: DIMM
    Set: None
    Locator: DIMM_2
    Bank Locator: Not Specified
    Type: DDR2
    Type Detail: Synchronous
    Speed: 667 MHz
    Handle 0x1103, DMI type 17, 27 bytes
    Memory Device
    Array Handle: 0x1000
    Error Information Handle: Not Provided
    Total Width: 64 bits
    Data Width: 64 bits
    Size: 1024 MB
    Form Factor: DIMM
    Set: None
    Locator: DIMM_4
    Bank Locator: Not Specified
    Type: DDR2
    Type Detail: Synchronous
    Speed: 667 MHz
    Handle 0x1300, DMI type 19, 15 bytes
    Memory Array Mapped Address
    Starting Address: 0x00000000000
    Ending Address: 0x000FDFFFFFF
    Range Size: 4064 MB
    Physical Array Handle: 0x1000
    Partition Width: 1
    Handle 0x1400, DMI type 20, 19 bytes
    Memory Device Mapped Address
    Starting Address: 0x00000000000
    Ending Address: 0x0007FFFFFFF
    Range Size: 2 GB
    Physical Device Handle: 0x1100
    Memory Array Mapped Address Handle: 0x1300
    Partition Row Position: 1
    Interleave Position: 1
    Interleaved Data Depth: 1
    Handle 0x1401, DMI type 20, 19 bytes
    Memory Device Mapped Address
    Starting Address: 0x00080000000
    Ending Address: 0x000FDFFFFFF
    Range Size: 2016 MB
    Physical Device Handle: 0x1101
    Memory Array Mapped Address Handle: 0x1300
    Partition Row Position: 1
    Interleave Position: 1
    Interleaved Data Depth: 1
    Handle 0x1402, DMI type 20, 19 bytes
    Memory Device Mapped Address
    Starting Address: 0x00000000000
    Ending Address: 0x0007FFFFFFF
    Range Size: 2 GB
    Physical Device Handle: 0x1102
    Memory Array Mapped Address Handle: 0x1300
    Partition Row Position: 1
    Interleave Position: 2
    Interleaved Data Depth: 1
    Handle 0x1403, DMI type 20, 19 bytes
    Memory Device Mapped Address
    Starting Address: 0x00080000000
    Ending Address: 0x000FDFFFFFF
    Range Size: 2016 MB
    Physical Device Handle: 0x1103
    Memory Array Mapped Address Handle: 0x1300
    Partition Row Position: 1
    Interleave Position: 2
    Interleaved Data Depth: 1
    Handle 0x1410, DMI type 126, 19 bytes
    Inactive
    Handle 0x1800, DMI type 24, 5 bytes
    Hardware Security
    Power-On Password Status: Enabled
    Keyboard Password Status: Not Implemented
    Administrator Password Status: Enabled
    Front Panel Reset Status: Not Implemented
    Handle 0x1900, DMI type 25, 9 bytes
    System Power Controls
    Next Scheduled Power-on: *-* 00:00:00
    Handle 0x1B10, DMI type 27, 12 bytes
    Cooling Device
    Type: Fan
    Status: OK
    OEM-specific Information: 0x0000DD00
    Handle 0x1B11, DMI type 27, 12 bytes
    Cooling Device
    Type: Fan
    Status: OK
    OEM-specific Information: 0x0000DD01
    Handle 0x1B12, DMI type 126, 12 bytes
    Inactive
    Handle 0x1B13, DMI type 126, 12 bytes
    Inactive
    Handle 0x1B14, DMI type 126, 12 bytes
    Inactive
    Handle 0x2000, DMI type 32, 11 bytes
    System Boot Information
    Status: No errors detected
    Handle 0x8100, DMI type 129, 8 bytes
    OEM-specific Type
    Header and Data:
    81 08 00 81 01 01 02 01
    Strings:
    Intel_ASF
    Intel_ASF_001
    Handle 0x8200, DMI type 130, 20 bytes
    OEM-specific Type
    Header and Data:
    82 14 00 82 24 41 4D 54 01 01 00 00 01 A5 0B 02
    00 00 00 00
    Handle 0x8300, DMI type 131, 64 bytes
    OEM-specific Type
    Header and Data:
    83 40 00 83 14 00 00 00 00 00 C0 29 05 00 00 00
    F8 00 4E 24 00 00 00 00 0D 00 00 00 02 00 03 00
    19 04 14 00 01 00 01 02 C8 00 BD 10 00 00 00 00
    00 00 00 00 FF 00 00 00 00 00 00 00 00 00 00 00
    Handle 0x8800, DMI type 136, 6 bytes
    OEM-specific Type
    Header and Data:
    88 06 00 88 5A 5A
    Handle 0xD000, DMI type 208, 10 bytes
    OEM-specific Type
    Header and Data:
    D0 0A 00 D0 01 03 FE 00 11 02
    Handle 0xD100, DMI type 209, 12 bytes
    OEM-specific Type
    Header and Data:
    D1 0C 00 D1 78 03 07 03 04 0F 80 05
    Handle 0xD200, DMI type 210, 12 bytes
    OEM-specific Type
    Header and Data:
    D2 0C 00 D2 F8 03 04 03 06 80 04 05
    Handle 0xD201, DMI type 126, 12 bytes
    Inactive
    Handle 0xD400, DMI type 212, 242 bytes
    OEM-specific Type
    Header and Data:
    D4 F2 00 D4 70 00 71 00 00 10 2D 2E 42 00 11 FE
    01 43 00 11 FE 00 0F 00 25 FC 00 10 00 25 FC 01
    11 00 25 FC 02 12 00 25 FC 03 00 00 25 F3 00 00
    00 25 F3 04 00 00 25 F3 08 00 00 25 F3 0C 07 00
    23 8F 00 08 00 23 F3 00 09 00 23 F3 04 0A 00 23
    F3 08 0B 00 23 8F 10 0C 00 23 8F 20 0E 00 23 8F
    30 0D 00 23 8C 40 A6 00 23 8C 41 A7 00 23 8C 42
    05 01 22 FD 02 06 01 22 FD 00 8C 00 22 FE 00 8D
    00 22 FE 01 9B 00 25 3F 40 9C 00 25 3F 00 09 01
    25 3F 80 A1 00 26 F3 00 A2 00 26 F3 08 A3 00 26
    F3 04 9F 00 26 FD 02 A0 00 26 FD 00 9D 00 11 FB
    04 9E 00 11 FB 00 54 01 23 7F 00 55 01 23 7F 80
    5C 00 78 BF 40 5D 00 78 BF 00 04 80 78 F5 0A 01
    A0 78 F5 00 93 00 7B 7F 80 94 00 7B 7F 00 8A 00
    37 DF 20 8B 00 37 DF 00 03 C0 67 00 05 FF FF 00
    00 00
    Handle 0xD401, DMI type 212, 172 bytes
    OEM-specific Type
    Header and Data:
    D4 AC 01 D4 70 00 71 00 03 40 59 6D 2D 00 59 FC
    02 2E 00 59 FC 00 6E 00 59 FC 01 E0 01 59 FC 03
    28 00 59 3F 00 29 00 59 3F 40 2A 00 59 3F 80 2B
    00 5A 00 00 2C 00 5B 00 00 55 00 59 F3 00 6D 00
    59 F3 04 8E 00 59 F3 08 8F 00 59 F3 00 00 00 55
    FB 04 00 00 55 FB 00 23 00 55 7F 00 22 00 55 7F
    80 F5 00 58 BF 40 F6 00 58 BF 00 EB 00 55 FE 00
    EA 00 55 FE 01 40 01 54 EF 00 41 01 54 EF 10 ED
    00 54 F7 00 F0 00 54 F7 08 4A 01 53 DF 00 4B 01
    53 DF 20 4C 01 53 7F 00 4D 01 53 7F 80 68 01 56
    BF 00 69 01 56 BF 40 FF FF 00 00 00
    Handle 0xD402, DMI type 212, 152 bytes
    OEM-specific Type
    Header and Data:
    D4 98 02 D4 70 00 71 00 00 10 2D 2E 2D 01 21 FE
    01 2E 01 21 FE 00 97 00 22 FB 00 98 00 22 FB 04
    90 00 11 CF 00 91 00 11 CF 20 92 00 11 CF 10 E2
    00 27 7F 00 E3 00 27 7F 80 E4 00 27 BF 00 E5 00
    27 BF 40 D1 00 22 7F 80 D2 00 22 7F 00 45 01 22
    BF 40 44 01 22 BF 00 36 01 21 F1 06 37 01 21 F1
    02 38 01 21 F1 00 39 01 21 F1 04 2B 01 11 7F 80
    2C 01 11 7F 00 4E 01 65 CF 00 4F 01 65 CF 10 D4
    01 65 F3 00 D5 01 65 F3 04 D2 01 65 FC 00 D3 01
    65 FC 01 FF FF 00 00 00
    Handle 0xD403, DMI type 212, 157 bytes
    OEM-specific Type
    Header and Data:
    D4 9D 03 D4 70 00 71 00 03 40 59 6D 17 01 52 FE
    00 18 01 52 FE 01 19 01 52 FB 00 1A 01 52 FB 04
    1B 01 52 FD 00 1C 01 52 FD 02 1D 01 52 F7 00 1E
    01 52 F7 08 1F 01 52 EF 00 20 01 52 EF 10 21 01
    52 BF 00 22 01 52 BF 40 87 00 59 DF 20 88 00 59
    DF 00 E8 01 66 FD 00 E9 01 66 FD 02 02 02 53 BF
    00 03 02 53 BF 40 04 02 53 EF 00 05 02 53 EF 10
    06 02 66 DF 00 07 02 66 DF 20 08 02 66 EF 00 09
    02 66 EF 10 17 02 66 F7 00 18 02 66 F7 08 44 02
    52 BF 40 45 02 52 BF 00 FF FF 00 00 00
    Handle 0xD800, DMI type 126, 9 bytes
    Inactive
    Handle 0xDD00, DMI type 221, 19 bytes
    OEM-specific Type
    Header and Data:
    DD 13 00 DD 00 01 00 00 00 10 F5 00 00 00 00 00
    00 00 00
    Handle 0xDD01, DMI type 221, 19 bytes
    OEM-specific Type
    Header and Data:
    DD 13 01 DD 00 01 00 00 00 11 F5 00 00 00 00 00
    00 00 00
    Handle 0xDD02, DMI type 221, 19 bytes
    OEM-specific Type
    Header and Data:
    DD 13 02 DD 00 01 00 00 00 12 F5 00 00 00 00 00
    00 00 00
    Handle 0xDE00, DMI type 222, 16 bytes
    OEM-specific Type
    Header and Data:
    DE 10 00 DE C1 0B 00 00 10 05 19 21 01 00 00 01
    Handle 0x7F00, DMI type 127, 4 bytes
    End Of Table
    Hdparm also does not tell me the max data transfer rate (disk speed) of my current drive although this link : www.wdc.com/en/library/sata/2879-001146.pdf  says that it is 3.0Gb/s
    and here's hdparm -I /dev/sda
    /dev/sda:
    ATA device, with non-removable media
    Model Number: WDC WD800JD-75JNC0
    Firmware Revision: 06.01C06
    Standards:
    Supported: 6 5 4
    Likely used: 8
    Configuration:
    Logical max current
    cylinders 16383 16383
    heads 16 16
    sectors/track 63 63
    CHS current addressable sectors: 16514064
    LBA user addressable sectors: 156250000
    Logical/Physical Sector size: 512 bytes
    device size with M = 1024*1024: 76293 MBytes
    device size with M = 1000*1000: 80000 MBytes (80 GB)
    cache/buffer size = 8192 KBytes
    Capabilities:
    LBA, IORDY(can be disabled)
    Standby timer values: spec'd by Standard, with device specific minimum
    R/W multiple sector transfer: Max = 16 Current = 8
    Recommended acoustic management value: 128, current value: 254
    DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 *udma5
    Cycle time: min=120ns recommended=120ns
    PIO: pio0 pio1 pio2 pio3 pio4
    Cycle time: no flow control=120ns IORDY flow control=120ns
    Commands/features:
    Enabled Supported:
    * SMART feature set
    Security Mode feature set
    * Power Management feature set
    * Write cache
    * Look-ahead
    * Host Protected Area feature set
    * WRITE_BUFFER command
    * READ_BUFFER command
    * DOWNLOAD_MICROCODE
    SET_MAX security extension
    Automatic Acoustic Management feature set
    * Device Configuration Overlay feature set
    * Mandatory FLUSH_CACHE
    * SMART error logging
    * SMART self-test
    * Gen1 signaling speed (1.5Gb/s)
    * Host-initiated interface power management
    * SMART Command Transport (SCT) feature set
    * SCT Long Sector Access (AC1)
    * SCT LBA Segment Access (AC2)
    * SCT Error Recovery Control (AC3)
    * SCT Features Control (AC4)
    * SCT Data Tables (AC5)
    Security:
    Master password revision code = 65534
    supported
    not enabled
    not locked
    frozen
    not expired: security count
    not supported: enhanced erase
    Checksum: correct
    Last edited by Inxsible (2011-03-27 04:40:49)

    I just checked my BIOS and my current setting is set at IDE although it also mentions that the default should be AHCI. Currently I have a dual boot of Windows 7 (need it for Tax software) and Arch
    So I guess, when I get the new HDD, I will first set it to AHCI and then install the OSes on it. See if NCQ helps any, and if not I will turn it back and re-install (if I have to). I am planning to have Windows only in virtualbox in the new drive.
    Anyhoo, while I was in the BIOS I found two things which I had questions about :
    1) Under Onboard Devices --> Integrated NIC , my setting is currently set at "On w/PXE" and it says the default should be just "On". Would it be ok to change it back to On since its a single machine and its not booting an OS on any server. I just don't want to have to re-install anything now since I will be doing that in the new HDD.
    2) How would I know whether my BIOS would support a 64 bit OS in Virtualbox? I checked some setting under Virtualization, but they weren't very clear.
    I will edit this post and let you know exactly what settings were present under the Virtualization sub-section.

  • How to get the max value of a set of percentage values?

    Hi,
    I've tried to get the max and min value of a set of calculated percentage values. Such as
    Jan Feb March Apr May Jun    Min  Average   Max
    0,5 0,8  1,1      0,4 1      0,6     0,4   0,7         1,1
    The average value works fine. But with "min" and "max" I have a problem.
    I've tried to get the value with the following ways:
    - Create a new calc. keyfigure and make a sum of all values: (Jan + Feb + ...) and set the calculation in key figure properties to Min/Max.
    - Create a new calc. keyfigure and make a sum of all values and set the aggregation to Min/Max
    - Create a selected keyfigure with a filter to the necessary periods and set a calculation to Min (Aggregation is not possible here)
    - Create a new cal. keyfigure with all periods and the function Min. e.g. min(Jan, (min Feb, (min (....)
    None of this solutions provides the right min and max value. When I use an amount value (e.g. Euro) instead of these percentage values the keyfigure with the min and max function works. The others all provide wrong values.
    Is there a solution to get the right min and max value???
    It would be a great help when you have any hints.
    Thanks
    Claudia

    Hi Aduri,
    thanks for your answer but your solution doesn't work.
    The problem is that the periods are defined in a structure with offsets such as
    - period-11
    - period-10
    - period
    in this structure elements there is also the keyfigure "netvalue" defined.
    In the rows of the report there is another characteristic such as company code.
    Is there a solution to find the max and min values of the period values for each company code? Or must I change the data model e.g. copy the keyfigure and make a new keyfigure with another aggregation level?
    Thanks for any hints!
    Claudia

  • 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')

Maybe you are looking for

  • Subtemplate in RTF template

    Hi, Can anyone tell me if it is possible to add sub-template in footer of RTF template. Thanks, Swapnesh

  • Edit print layout template for dunning letters

    Hi, Our customer want to edit the dunning letter template. They want the TOTAL which is a system variable field be seen also in the start of report I copied this field from "Field_057," which is the field with the same name in the end of the report,

  • Boot Camp Windows OS won't download

    Using Boot Camp I installed Windows XP Professional SP3 and ran the Boot Camp disc. Now the problem is Windows, which I've never used before. I needed to use it for one program that Mac doesn't run, but it won't let me download anything from the inte

  • Query for geetiing no.of working days

    Hi All, How can we write a query for geetiing no.of working days in Oracle Apps. Basically we need to mention no.of working days in the Work-Flow Form but not the no.of days. So how can we write a query for getting no.of working days.and Where can we

  • Adobe content viewer authentication failed

    My client is trying to see the folio on his ipad on the adobe content viewer, his adobe id can connect in acrobat.com but not into the adpbe content viewer app, Any solution?