Need help in SQL programming

Hi all

We need a simple query that needed to avoid the custom code in our engine of journalist.

Existing report:
Overall use of Volume

Tables involved:
ent_host_disk_usage: (Mo used aggregates and mapped to the aggregate volume are in the same table)
netapp_volumes_to_aggregates_current: mapping between the granulate and volume
devices of

This should show current and historical information based on the report quick selection .the existing report uses the
the current data to historical query also.

the solution that need us:

We need the model query to use the ent_host_disk_usage as the base table, so when the current option is selected it using the ent_host_disk_usage_current table
and when summaries are selected it using the table ent_host_disk_usage for the volume and the amount.

Who ever gives the best query will be greatly thanked

Refer to the table below for the example:

disk_usage table
------------------------
filesystemid    usedmb    spType
-----------------------------------------------------------------          
aggr     10000     aggregate 
/vol      100         FS 
c:        1000        FS 
aggr2   5000       aggregate 
d:        100         FS 
f:         200         FS 
e:        300         FS 
mapping table
------------------------
aggregate name     filesystemid
--------------------------------------------------------------------------     
aggr1     /vol
aggr1     c:
aggr2     d:
aggr2     f:
aggr2     e:
Report:
--------------------
name     used     vol     used
---------------------------------------------------------------------------
aggr1     10000     /vol     100
aggr1     10000     c:     1000
aggr2     5000     d:     100
aggr2     5000     e:     300
aggr2     5000     f:     200
Published by: user11101052 on April 25, 2009 10:01

Hello

Welcome to the forum!

This site compress space. If you want to post something that is formatted as a table, type the 6 characters
{code}
(small letters only, inside curly braces) before and after the formatted text, to maintain spacing.

It looks like you want a row of output for each line of the mapping. Both used columns (it would be less confusing to give them different names: I'll call them a_used and f_used) comes from the disk_usage table: this seems to call for a join. The problem is that, to get a_used to connect using aggregate_name and is f_used, that you need to include using filesystemid. It would be easy if they are in two different tables. You can imagine that they are in two different tables, by joining two copies of the same table, like this:

SELECT     m.aggregate_name
,     a.usedmb          AS a_used
,     m.filesystemid
,     f.usedmb          AS f_used
FROM     mapping          m
JOIN     disk_usage     a     ON  m.aggregate_name  = a.filesystemid
JOIN     disk_usage     f     ON  m.filesystemid    = f.filesystemid;

Tags: Database

Similar Questions

  • I need help with the program of Photos on my macbook pro

    I use a Macbook Pro with OS of Yosemite. I really need help with the Photo program. I never really got the hang of IPhoto and now that it's a new program, I'm really confused. Where can I go to learn this without waiting for the next workshop in a local store?

    Hi, I'm fighting to open same mine, making a new software update

  • Need help with Sql Tunning

    Under Update taking 2 h complete 3000 sets.

    UPDATE ARR_TRANSACTIONS ARR

    SET = NUMBER99

    (SELECT ARR_1.NUMBER99

    OF ARR_TRANSACTIONS ARR_1, ARR_HEADER BH

    WHERE ARR_1.ARR_ID = BH. ARR_ID

    AND BH. FLAG = "Y".

    AND ARR_1.LINE_ID = ARR. ORIG_INV_LINE_ID

    AND ARR_1.NUMBER9 IS NOT NULL

    AND ROWNUM = 1)

    WHERE ARR BATCH_ID = 26219

    AND ARR. NUMBER99 IS NULL

    I added more some condition where to reduce cost and its working fine. But I need to rise more than performance on SQL.

    Please help with SQL.

    I do not see the number of 3000 lines in the plan - so I guess that the optimizer does not compute with the correct numbers. Could generate the plan with dbms_xplan.display_cursor? This could tell us something about filter predicates and access.

    In the given situation, I would check:

    • is the access to the index in step 1 (filtered by the relevant conditions: this could be BATCH_ID = 26219) return actually 248 entries (or something similar)?
    • Access table in step 2 returning 204 lines (or something similar) after applying the filters given? If the number of lines is much bigger then a Nested Loops is perhaps not a good idea.

    To make this much simpler check, you could create a plan with statistics of content (RowSource) given that the plan containing the real and the number of estimated rows.

    If the estimated cardinalities are not plausible the next question would be if the statistics are strong and up to date.

  • Need help with SQL/PL/SQL for Dates

    Hi Experts - need help with a SQL query.

    I need to insert some date fields in a table called CALENDAR_PERIOD.

    Current data in CALENDAR_PERIOD table with their data types:

    STARTPERIOD (DATE) YEAR (NUMBER) PERIOD_LABEL (Varchar2 255)

    02/11/2014 2014 2014/02/11 SUN

    03/11/2014 2014 14/03/11 MON

    04/11/2014 2014 11/04/14 MAR

    I have to increment above values up to the year 2025. I don't know how to write SQL and increment of these values.

    Ex: My next value should insert: 05/11/2015 2014 11/05/14 WED like that I need to insert data until 12 31, 2025.

    Can you please help me with PL/SQL block?

    Really appreciate your help!

    DB version:

    Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production

    PL/SQL Release 11.2.0.3.0 - Production

    CORE Production 11.2.0.3.0

    AMT for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production

    NLSRTL Version 11.2.0.3.0 - Production

    Thank you
    Sandy

    Hello Sandy,

    Maybe something like

    INSERT INTO calendar_period (startperiod, year, period_label)

    SELECT DATE '' 2014-11-04 + LEVEL

    , TO_NUMBER (TO_CHAR (DATE '' 2014-11-04 + LEVEL, "YYYY"))

    , TO_CHAR (DATE '' 2014-11-04 + LEVEL, "MM/DD/YY DY")

    OF the double

    CONNECT BY LEVEL<= date="" '2025-12-314="" -="" date="">

    ;

    ((mais je ne comprends pas pourquoi nous créons une telle table "année" et "period_label" peuvent être calculé à partir de startperiod))

    Best regards

    Bruno Vroman.

  • I need help downloading my programs on my computer

    I design creator standard adobe and I need help download on my MacBook Pro

    Download & install instructions https://forums.adobe.com/thread/2003339 can help

    -includes a link to access a page to download the Adobe programs if you do not have a disk or drive

    Also go to https://forums.adobe.com/community/creative_cloud/creative_cloud_faq

    - and also read https://forums.adobe.com/thread/1146459

    In addition, this information is a MUST to install old programs on Mac El Capitan

    -You can't get the same error message, but these links that CAN help with old programs

    Install CS5 on Mac 10.11 https://forums.adobe.com/thread/2003455 can help (also for others than CS5)

    -also a TEMPORARY security change https://forums.adobe.com/thread/2039319

    -http://mac-how-to.wonderhowto.com/how-to/open-third-party-apps-from-unidentified-developer s-mac-os-x-0158095 /

    FAQ on the Mac 10-11 https://forums.adobe.com/thread/1979303

  • Need help. This program is a Virus? Pop-ups__Windows XP - Groovy walrus - BACK

    1 wmpscfgs.exe is this a virus?

    http://i259.Photobucket.com/albums/hh282/chips909/pop-up.PNG

    2 svchost.exe is a virus?

    http://i259.Photobucket.com/albums/hh282/chips909/pop-up02.PNG

    Well, I got some virus lately. :/ av.exe and much more.

    I had a few problems if you could help me.
    Theres been more there just very quickly.

    http://social.answers.Microsoft.com/forums/en-us/XPRepair/thread/113d3b55-d4b3-47f1-8d61-c8fdf86d8a1b/#5d486d42-0fc0-4393-9A18-12828db6bae9

    This is my another Post. I really need help.

    This virus has turned off my registry Variables. I get the error message: «Registry editing has been disabled by your Adimn.»
    How can I fix?

    --------------------
    Csrss.exe - Virus?
    Lsass.exe - Virus?
    mbptn.exe - Virus?
    sttray.exe - Virus?
    Smss.exe - Virus?
    Svchost.exe - Virus?
    Winlogon.exe - Virus?
    Spoolsv.exe - Virus?
    bgsvcgen.exe Virus?
    jqs.exe - Virus
    MDM.exe - Virus?
    --------------------

    Please answer this can't is\isn a Virus that I have just listed.
    Thank you
    -Morse groovy-

    Csrss.exe - Virus?

    normally no; See http://www.neuber.com/taskmanager/process/csrss.exe.html
    Lsass.exe - Virus?
    normally no; See http://www.neuber.com/taskmanager/process/lsass.exe.html
    mbptn.exe - Virus?
    normally no; See http://www.neuber.com/taskmanager/process/mpbtn.exe.html
    sttray.exe - Virus?
    No.; See above site (sigmatel audio)
    Smss.exe - Virus?
    normally no; Well that eventually check infection http://www.neuber.com/taskmanager/process/smss.exe.html
    Svchost.exe - Virus?
    No.; Generic Host Process for Win32 Services
    Winlogon.exe - Virus?
    No.; logon XP
    Spoolsv.exe - Virus?
    No.; service of ms coils
    bgsvcgen.exe Virus?
    No.; TMPGEnc DVD with DivX Authoring Authorr3
    jqs.exe - Virus
    No.; Java quick start
    MDM.exe - Virus?
    No; machine debug manager
  • I need help [bought showing program as the trial]

    with my photoshop, because I paid 275 for 1 year. In creative cloud, I read rest 30 days

    [Title edited for clarity... MOD]

    Your subscription to cloud shows correctly on your account page?

    If you have more than one email, you will be sure that you use the right Adobe ID?

    https://www.adobe.com/account.html for subscriptions on your page from Adobe

    .

    If Yes

    Sign out of your account of cloud... Restart your computer... Connect to your paid account of cloud

    -Connect using http://helpx.adobe.com/x-productkb/policy-pricing/account-password-sign-faq.html

    -http://helpx.adobe.com/creative-cloud/kb/sign-in-out-creative-cloud-desktop-app.html

    -http://helpx.adobe.com/x-productkb/policy-pricing/activation-network-issues.html

    -http://helpx.adobe.com/creative-suite/kb/trial--1-launch.html

    -ID help https://helpx.adobe.com/contact.html?step=ZNA_id-signing_stillNeedHelp

    -http://helpx.adobe.com/creative-cloud/kb/license-this-software.html

    .

    If no

    This is an open forum, Adobe support... you need Adobe personnel to help

    Adobe contact information - http://helpx.adobe.com/contact.html

    Chat/phone: Mon - Fri 05:00-19:00 (US Pacific Time)<=== note="" days="" and="">

    -Select your product and what you need help with

    -Click on the blue box "still need help? Contact us. "

  • need help with SQL Server 2008 R2 deadlock uninstall process

    I installed SQL Server 2008 R2 trial version on my PC running Windows Vista Ultimate, a day ago, but he placed himself completely in the disk partition (E :) that I specified. [i.e. I found some parts of the installation in my C:\program files as well as a USB as well].

    I tried to uninstall SQL Server 2008 R2, but was only partially successful.  I'm prevented from uninsalling the main parts using the programs and features Panel - that is "Microsoft SQL Server 2008 R2" and "Microsoft SQL Server 2008 R2 Setup (in English).

    Still visible are:

    1 C:\Program Files (x 86) \Microsoft SQL Server

    2 C:\Program Files (x 86) \Microsoft Visual Studio 9.0

    3 C:\ProgramData\Microsoft\Windows\Start demarrer\programmes\microsoft SQL Server 2008 R2

    I would like your help to uninstall the other goals of SQL Server, so that I can do a clean install once more.

    Any advice on how SQL Server 2008 R2 evaluation version must be correctly installed what a future unistall is not messy, would be welcome.

    Hello

    Your question of Windows 7 is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for the SQL Server forums. Please post your question in the SQL Server forums.

    http://social.msdn.Microsoft.com/forums/en/category/SQLServer

  • Need help with sql query

    Dear all,

    I have a sql like query below

    SELECT min (G.TRANSACTION_DATE), D.REQUEST_NUMBER

    MTL_TXN_REQUEST_HEADERS D,.

    MTL_TXN_REQUEST_LINES, E.

    MTL_MATERIAL_TRANSACTIONS G,.

    Mtl_Transaction_Types I have

    WHERE D.HEADER_ID = E.HEADER_ID

    AND G.TRANSACTION_TYPE_ID = I.TRANSACTION_TYPE_ID

    AND Upper (I.Transaction_Type_Name) = Upper ('TEC outcome')

    AND E.LINE_ID = G.MOVE_ORDER_LINE_ID

    AND D.MOVE_ORDER_TYPE = 5

    TO_DATE (G.TRANSACTION_DATE) BETWEEN TO_DATE('01-JAN-2014') AND TO_DATE('31-DEC-2014')

    D.REQUEST_NUMBER GROUP

    I need to get the first number of the application and finally ask for number based on the date of the transaction, how can I get the number of name application and based on the date of the transaction for the same query, please help me.

    above query is back under results

    results.jpg

    If the query should return a line with the number of application like 2383 based on minimum transaction date and another column based on the maximum transaction date, please help me.

    so in the example above, it must return

    FIRST REQUEST NUMBER LAST NUMBER

    2383                                      1886

    Thank you

    select min(request_number) keep(dense_rank first order by transaction_date asc ) request_number_min
         , min(request_number) keep(dense_rank first order by transaction_date desc) request_number_max
      from (
            select min(g.transaction_date) transaction_date
                 , d.request_number
              from mtl_txn_request_headers d
                 , mtl_txn_request_lines e
                 , mtl_material_transactions g
                 , mtl_transaction_types i
             where d.header_id                    = e.header_id
               and g.transaction_type_id          = i.transaction_type_id
               and upper(i.transaction_type_name) = upper('WIP Issue')
               and e.line_id                      = g.move_order_line_id
               and d.move_order_type              = 5
               and to_date(g.transaction_date) between to_date('01-jan-2014') and to_date('31-dec-2014')
             group
                by d.request_number
           )
    
  • Need help with sql query performance

    Dear all,

    I have a sql like query below, I need to give the following query please help me identify which statement I should tune to have better performanece.

    Select rownum LINE_NUM,

    A.LINE_ID,

    TO_CHAR (A.INVITMID),

    TO_NUMBER (A.PICKQTY),

    UNLOADINGPNT NULL,

    RRNUM NULL,

    WORKORDNUM NULL,

    WORKORDDESC NULL,

    A.PONUM,

    DTR_DUMB NULL,

    A.DESCRIPTION,

    FROM_SUB NULL,

    TO_SUB NULL,

    NO SOURCE,

    ASSET_NUMBER NULL,

    A.RECEIPTNUM,

    MOVEORD NULL,

    FROM_LOC NULL,

    TO_LOC NULL,

    MSD_NUM NULL,

    CONTAIN_LINE NULL,

    A.UOM,

    A.PO_RELEASE

    de)

    Select headerid Po.Po_Header_Id,

    rcv1. Po_Line_Id LINE_ID,

    rcv1.item_id INVITMID,

    (NVL(Rcv1.Transact_Qty,0)-NVL(rcv2.transact_qty,0)) PICKQTY,

    Po.Segment1 PONUM,

    Rcv1.Receipt_Num RECEIPTNUM,

    Rcv1.Item_Desc DESCRIPTION,

    Rcv1.Transact_Uom GLU,

    Rcv1.Po_release

    Po_Headers_All in.,.

    (Select rcv3. Po_Header_Id, RCV3.receipt_num, rcv3. Po_Line_Id, rcv3. Destination_Type_Code, rcv3. Item_Id, rcv3. Item_Desc, rcv3. Transact_Uom, SUM (rcv3. Transact_Qty) Transact_Qty, rcv3. PO_RELEASE OF)

    SELECT A.Po_Header_Id,

    C.RECEIPT_NUM receipt_num,

    A.Po_Line_Id,

    A.Destination_Type_Code,

    B.Item_Id,

    B.item_description Item_Desc,

    A.UNIT_OF_MEASURE Transact_Uom,

    A.QUANTITY Transact_Qty,

    D.RELEASE_NUM PO_RELEASE

    OF RCV_TRANSACTIONS,.

    RCV_SHIPMENT_HEADERS C.

    B RCV_SHIPMENT_LINES,

    PO_RELEASES_ALL D

    WHERE C.SHIPMENT_HEADER_ID = A.SHIPMENT_HEADER_ID

    AND B.SHIPMENT_LINE_ID = A.SHIPMENT_LINE_ID

    AND UPPER (A.Transaction_Type) = "to DELIVER".

    AND higher (A.Destination_Type_Code) = "EXPENSES".

    AND D.PO_RELEASE_ID = A.PO_RELEASE_ID

    UNION ALL

    SELECT A.Po_Header_Id,

    C.RECEIPT_NUM receipt_num,

    A.Po_Line_Id,

    A.Destination_Type_Code,

    B.Item_Id,

    B.item_description Item_Desc,

    A.UNIT_OF_MEASURE Transact_Uom,

    A.QUANTITY Transact_Qty,

    D.RELEASE_NUM PO_RELEASE

    OF RCV_TRANSACTIONS,.

    RCV_SHIPMENT_HEADERS C.

    B RCV_SHIPMENT_LINES,

    PO_RELEASES_ALL D

    WHERE C.SHIPMENT_HEADER_ID = A.SHIPMENT_HEADER_ID

    AND B.SHIPMENT_LINE_ID = A.SHIPMENT_LINE_ID

    AND B.ITEM_ID IS NULL

    AND UPPER (A.Transaction_Type) = "to DELIVER".

    AND higher (A.Destination_Type_Code) = "WORKSHOP".

    D.PO_RELEASE_ID AND = A.PO_RELEASE_ID) rcv3

    GROUP BY rcv3. Po_Header_Id, RCV3.receipt_num, rcv3. Po_Line_Id, rcv3. Destination_Type_Code, rcv3. Item_Id, rcv3. Item_Desc, rcv3. Transact_Uom, rcv3. Rcv1 PO_RELEASE),

    (SELECT A.PO_LINE_ID,

    Sum (A.Quantity) transact_qty,

    A.PO_HEADER_ID,

    C.RECEIPT_NUM

    OF RCV_TRANSACTIONS,.

    RCV_SHIPMENT_HEADERS C.

    B RCV_SHIPMENT_LINES,

    PO_RELEASES_ALL D

    WHERE C.SHIPMENT_HEADER_ID = A.SHIPMENT_HEADER_ID

    AND B.SHIPMENT_LINE_ID = A.SHIPMENT_LINE_ID

    AND UPPER (A.Transaction_Type) = "RETURN to the RECEPTION"

    AND D.PO_RELEASE_ID = A.PO_RELEASE_ID

    A.PO_LINE_ID, A.PO_HEADER_ID, C.RECEIPT_NUM GROUP) Rcv2

    Where Po.Po_Header_Id = Rcv1.Po_Header_Id (+)

    And Rcv1.Po_Line_Id = Rcv2.Po_Line_Id (+)

    And Rcv1.Receipt_Num = Rcv2.Receipt_Num (+)

    And Rcv1.Transact_Qty <>Nvl(Rcv2.Transact_Qty,999999999)

    Group of po.po_header_id, rcv1.po_line_id, po.segment1, rcv1.receipt_num, rcv1.item_id, Rcv1.Item_Desc, rcv1. TRANSACT_UOM, rcv1. PO_RELEASE, (NVL(Rcv1.Transact_Qty,0)-NVL(RCV2.transact_qty,0))) has

    Is my version of the database: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production

    Please find the attached PLAN to EXPLAIN.

    EXPLAINPLAN.jpg

    Thank you

    May be essentially the same join (between a, b, c and d) twice instead of three times

    sounds like it could be done with a single join (between a, b, c, and d), but you do not some columns than the columns of rcv1 rcv2

    We can work on what we can see only

    Select rownum line_num,

    rcv1.po_line_id line_id,

    TO_CHAR (rcv1.item_id) invitmid,

    NVL(rcv1.transact_qty,0) - nvl(rcv2.transact_qty,0) pickqty,

    unloadingpnt null,

    rrnum null,

    workordnum null,

    workorddesc null,

    Po. Ponum Segment1,

    dtr_dumb null,

    description of the rcv1.item_desc,

    from_sub null,

    to_sub null,

    No source,

    asset_number null,

    rcv1.receipt_num receiptnum,

    moveord null,

    from_loc null,

    to_loc null,

    msd_num null,

    contain_line null,

    Glu rcv1.transact_uom,

    rcv1.po_release

    of po_headers_all in.

    left outer join

    (select a.po_header_id,

    c.receipt_num,

    a.po_line_id,

    a.destination_type_code,

    b.item_id,

    b.item_description item_desc,

    a.unit_of_measure transact_uom,

    Sum (a.Quantity) transact_qty,

    d.release_num po_release

    from (select shipment_header_id,

    shipment_line_id,

    po_release_id,

    po_header_id,

    po_line_id,

    destination_type_code,

    unit_of_measure,

    quantity

    of rcv_transactions

    where upper (a.transaction_type) = "to DELIVER".

    and upper (a.destination_type_code) ('charge', 'WORKSHOP')

    ) a

    inner join

    rcv_shipment_lines b

    On a.shipment_line_id = b.shipment_line_id

    inner join

    c rcv_shipment_headers

    On a.shipment_header_id = c.shipment_header_id

    left outer join

    po_releases_all d

    On a.po_release_id = d.po_release_id

    where upper (a.destination_type_code) = "EXPENSES".

    or (upper (a.destination_type_code) = 'WORKSHOP'

    and b.item_id is null

    )

    A.po_header_id group,

    c.receipt_num,

    a.po_line_id,

    a.destination_type_code,

    b.item_id,

    b.item_description,

    a.unit_of_measure,

    d.release_num

    ) rcv1

    On po.po_header_id = rcv1.po_header_id

    left outer join

    (select a.po_line_id,

    Sum (a.Quantity) transact_qty,

    a.po_header_id,

    c.receipt_num

    from (select shipment_header_id,

    shipment_line_id,

    po_release_id,

    po_header_id,

    quantity

    of rcv_transactions

    where upper (a.transaction_type) = "RETURN to THE RECIPIENTS.

    ) a

    inner join

    rcv_shipment_lines b

    On a.shipment_line_id = b.shipment_line_id

    inner join

    c rcv_shipment_headers

    On a.shipment_header_id = c.shipment_header_id

    left outer join

    po_releases_all d

    On a.po_release_id = d.po_release_id

    A.po_line_id group,

    a.po_header_id,

    c.receipt_num

    ) rcv2

    On rcv1.po_line_id = rcv2.po_line_id

    and rcv1.receipt_num = rcv2.receipt_num

    where rcv1.transact_qty! = nvl(rcv2.transact_qty,999999999)

    Concerning

    Etbin

  • need help with sql queries

    Dear all,

    I have a parameter like below

    11000048,11000050

    I need to convert in SQL format below, please help me

    "11000048","11000050"


    ' parameter would be so separated by commas, I need to convert in above format, if the parameter is a number say 1111111 must convert it as "1111111" in sql.


    Please help me.


    Thank you

    You can do it

    your_parameter: = "" ' | " Replace (your_parameter, ",", "",""). '"';

  • Need help, a finishing program

    Hey,.

    I need somehelp in ActionScript 3. So I am a beginner looking for help. I start to make a program that converts the traditional hour standard time. Already have my variables, I don't know how to finish the program. So basically if the user is prompted to enter a time like "14:22:10"the lblOutput.text should display '14:22 '. " I will include the code below. Thanks in advance. I've included where code needs to be written, I don't know how to convert.

    This line makes the button, wait for a mouse click btnConvert
    When the button is clicked, the function convertTime is called
    btnConvert.addEventListener (MouseEvent.CLICK, convertTime);

    This line makes the textinput wait for a mouse click
    When this feature is enabled, the clearLabels function is called
    txtinStandard.addEventListener (MouseEvent.CLICK, clearLabels);

    Declare Global Variables
    var traditionalTime:String;    traditional time

    This is the function convertTime
    e:MouseEvent is the experienced by the button click event
    void indicates that the function does not return a value
    function convertTime(e:MouseEvent):void
    {
    Declare variables
    var standardTime:String;    standard time is entered by the user

    standardTime = txtinStandard.text;     get the user's normal time
    convertToTraditional (standardTime);    call the convertToTraditional function

    generate a message in the label
    lblOutput.text = standardTime "is equivalent to" + traditionalTime;
    }

    It's convertToTraditional function
    s is the standard time
    It determines the traditional duration based on the value of s
    function convertToTraditional(s:String)
    {
    type the code here

    {
    It's the clearLabels function
    e:MouseEvent is the click experienced by the textInput event
    void indicates that the function does not return a value
    function clearLabels(e:MouseEvent):void
    {
    lblOutput.text = "";
    txtinStandard.text = "";
    }

    What you need to do is to divide the string value and evaluate the part of it that determines whether it is AM or PM.

    Focus on the use of the String.Split method to have the chain broken at the colon (:)).

    Which will produce a table accordingly and you want to watch the element of index 0 of this table to determine whether it is AM or PM value.  So you want to convert to a value< 13="" if="" it="" is="" a="" pm="">

  • Need help with SQL Query - change of name history of audit table.

    I need your help to find the result in the following way...


    Emp No    New_name    Old_Name
    -----------------------------------------------
    1           Name3        Name2
    1           Name2        Name1
    create table emp(emp_id number(10),
    emp_name varchar(50),
    constraints emp_pk primary key(emp_id) );
    
    
    
    create table emp_audit(
    audit_id number(10),
    emp_id number(10),
    emp_name varchar(50),
    audit_date date,
    constraints emp_audit_pk primary key (audit_id),
    constraints  emp_audit_emp_fk foreign key(emp_id)  references emp(emp_id));
    
    insert into emp values(1,'Name3');
    
    
    insert into EMP_AUDIT (audit_id, emp_id, emp_name, audit_date)
    values (1, 1, 'Name1', to_date('14-08-2011', 'dd-mm-yyyy'));
    insert into EMP_AUDIT (audit_id, emp_id, emp_name, audit_date)
    values (2, 1, 'Name2', to_date('15-08-2011', 'dd-mm-yyyy'));
    commit;
    Thank you...

    Dipabkar Bédard (DB) wrote:

    We write is the query without using "partition by" in oracle...?

    with t as (
               select  audit_id,
                       emp_id,
                       emp_name,
                       row_number() over(order by audit_id) rn
                 from  emp_audit
                 order by emp_id,
                          audit_id
              )
    select  a.audit_id,
            a.emp_id,
            a.emp_name old_name,
            nvl(b.emp_name,(select c.emp_name from emp c where c.emp_id = a.emp_id)) new_name
      from  t a left join t b
            on (
                    b.emp_id = a.emp_id
                and
                    b.rn = a.rn + 1
               )
    /
    
      AUDIT_ID     EMP_ID OLD_NAME                                           NEW_NAME
    ---------- ---------- -------------------------------------------------- ------------
             1          1 Name1                                              Name2
             2          1 Name2                                              Name3
    
    SQL> 
    

    And without analytical functions:

    with t1 as (
                select  audit_id,
                        emp_id,
                        emp_name
                  from  emp_audit
                  order by emp_id,
                           audit_id
               ),
         t2 as (
                select  audit_id,
                        emp_id,
                        emp_name,
                        rownum rn
                  from  t1
               )
    select  a.audit_id,
            a.emp_id,
            a.emp_name old_name,
            nvl(b.emp_name,(select c.emp_name from emp c where c.emp_id = a.emp_id)) new_name
      from  t2 a left join t2 b
            on (
                    b.emp_id = a.emp_id
                and
                    b.rn = a.rn + 1
               )
    /
    
      AUDIT_ID     EMP_ID OLD_NAME                                           NEW_NAME
    ---------- ---------- -------------------------------------------------- ----------
             1          1 Name1                                              Name2
             2          1 Name2                                              Name3
    
    SQL> 
    

    SY.

  • Run multiple chooses due to several input values (need help in SQL)

    Hello

    I would need to run multiple SQL select statements I get input of several results of the subquery. In my test case, I get three 3 results of the subquery

    Select ALL_TABLES where LAST_ANALYZED is not null AND OWNER of TABLE_NAME = "IHS" AND TABLE_NAME LIKE '_TBL_PROCESS %' AND (SYSDATE-LAST_ANALYZED) < 1 order by (SYSDATE-LAST_ANALYZED
    The complete query is:

    SELECT SDE_ID, SERVER_ID, REGISTRATION_ID, TABLE_NAME, CONNECTOR, START_TIME, NODENAME OF THE

    * (select ALL_TABLES where LAST_ANALYZED is not null AND OWNER of TABLE_NAME = 'IHS' AND TABLE_NAME LIKE '_TBL_PROCESS %' AND (SYSDATE-LAST_ANALYZED) < 1 order by (SYSDATE-LAST_ANALYZED)) *.

    Can someone help me to get the appropriate SQL code?

    Thank you
    Dejan

    Right. I should have put a comment explaining that. I used the name A_TBL_PROCESS because the WHERE clause has
    'AND table_name like '% _TBL_PROCESS' ' then yes that should be a table name that will be selected.

  • need help on sql on the full month

    Hello

    I have a table as below:

    The table name:

    Information
    -----------------
    staff_number
    Date
    clock_in
    clock_out
    Note

    I want to create sql which will list down all date selection staffnumber

    Select date, clock_in, staff_number, clock_out, information note where (date > = to_date('01/01/2010') and date < = to_date('01/02/2010')) and staff_number = "012345 '



    Can someone help me on how to change the sql code out in the list, if there is no database on a certain date.

    For example
    012345 8.10 01/01/2010 17:30
    012345 8.12 02/01/2010 16:30
    012345 03/01/2010 - not in the database, but I want it appears in sql
    012345 04/01/2010 08:30 18:40
    012345 8.10 05/01/2010 16:30
    012345 06/01/2010 08:30 16:30
    ....
    012345 8.10 02/01/2010 16:30


    Thanks in advance

    You don't need LAST_DAY then:

    select to_date('13/01/2010', 'dd/mm/rrrr')+ level-1 dt
    from dual
    connect by level <= to_date('23/02/2010', 'dd/mm/rrrr')-to_date('13/01/2010', 'dd/mm/rrrr')+1;
    

    (And subtract from the most recent date)

Maybe you are looking for