MBAM 2.5 - Query

Hi All,
I need some clarity on the below please
1. If my laptop mother board or TPM got damaged and i wanted to recover the same. Can i connect to a different machine and recover the PIN?  Please advice
2. Can i use virtualized solution for MBAM
3. Can i set the limitation in MBAM incase an hacker tries to enter too many PINS and i will be alerted or making the system locked
4. Is there any security logs in MBAM that can be used for auditing
Regards, Pratap

3). This is controlled entirely by the manufacturer of the TPM chip, and is not adjustable. Please see the 'Bitlocker FAQ' (link goes to the 'How does BitLocker help prevent
an attacker from discovering the PIN that unlocks my operating system drive' section).
Any advice please, is there a way I decrypt the machine automatically trough policy
Please read through the 'Planning for MBAM 2.5 Group Policy Requirements' article, there are a couple of Policies that state that they will decrypt drives if they are set properly.
Hope this helps,
David
MDOP on the Springboard Series on TechNet

Similar Messages

  • Recovery key from MBAM for non TPM machines

    Hi,
    Since long time am trying to find answer about below query but unlucky , can some one guide me if this is feasiable or not?
    1. I have non TPM Machines and want to use Bitlocker with MBAM.
    2. if I will use the USB flash driver as start-up key during machine start-up than can we get the recovery key from MBAM (self service or helpdesk portal) if I lost the USB flash drive ?
    Shailendra Dev

    Hi,
    For Windows 7 computers TPM is a requirement for Windows 8 / 8.1 it is not, so it depends in what client OS you want to manage.
    See the documentation:
    http://technet.microsoft.com/en-us/library/dn145046.aspx
    Regards,
    Jörgen
    -- My System Center blog ccmexec.com -- Twitter
    @ccmexec

  • Error: the 'MBAM Policy' view does not exist.

    MBAM 2.0 SP1 with SCCM 2012 integration:
    I am receiving this error when the reports are run from the reporting services point and from inside of the SCCM console. The view that the reports are testing for does exist in the SCCM database. I do not understand why the reports are giving this error.
    Each of these MBAM reports have a test for the view V_GS_MABM_POLICY :
        DECLARE @query nvarchar(70)
              SET @query = N'SELECT COUNT(EncodedComputerName0) AS Status FROM V_GS_MBAM_POLICY'
        BEGIN TRY
          EXEC(@query)
        END TRY
        BEGIN CATCH
          SELECT 0 AS Status
        END CATCH
    If the Try fails then you receive the above error message in Red Font.
    This view - V_GS_MBAM_POLICY does exist so I am not sure why this is occurring. I have completely redone the MBAM setup on the SCCM 2012 server after removing all the MBAM collection and reports, etc. following the instructions from this article -
    http://support.microsoft.com/kb/2831166 I also removed the classes. I ran the setup again - just the SCCM integration feature and it gives me the same results. Some have suggested that the inventory has
    to be collected by the clients first before these reports work and that doesn't appear to be the case. This red font error message is only shown if the view is not reachable. Anyone have any ideas?

    I was mistaken, the view is queried for a count and if 0, it displays that error message. So it may be correct that this is normal until the first clients return data that populates the MBAM/Bitlocker tables.

  • MBAM 2.5 Issue with Self Service Portal

    I have recently set up an MBAM 2.5 server to test with for a potential roll out of encryption to all laptops in our enterprise.  All seems well.  I have tested the recovery using the Drive Recovery option on the HelpDesk page and that works just
    fine.  I enter in the first 8 characters of the recovery key from the laptop and get back the 48 digit code.  I enter in the 48 digit code and I am in.
    The problem arises when I attempt using the SelfService Recovery option.  Once I put in the 8 characters in the Recovery Key ID box, select a reason and hit the Get Key button, it gives me a response of Invalid Key ID.  
    These are all laptops that I have already logged into with my account and it is the same account that I am using in the Self Service Portal.
    I had another user attempt it from his laptop with the same results.
    Any help would be appreciated.
    Thanks,
    Patrick

    - I've verified that the user attempting to get the Recovery Key ID from SSP has logged into the machine before (and the database confirms that).
    - Had another user from the device try the SSP - same issue. 
    - Verified that the Recovery Key ID can be used and get a Recovery Key from the HelpDesk portal - works. 
    - Pulled logs from the client and the server - no errors related to issuing recovery keys. 
    - The Recovery Audit Report shows that the two users (myself and the actual owner of the laptop) show "Failed" on the attempt, but the HelpDesk recoveries work (depicted). 
    Do the user's have to be in a specific group or anything to be able to get recovery keys from SSP? 
    What's even more weird is that my company is using MDOP MBAM as well and this is not a problem - Self Service works like a charm. This feels like there's some kind of permissions issue - especially since I was able to verify with a custom query that my user
    account was assigned to this machine and that I should be allowed to do this.
    Michael B Courville

  • MBAM 2.5 integrated with SCCM 2012 SP1 compliance issue

    Hi,
    I have installed MBAM 2.5 in a SCCM integrated topology. GPO for encryption on the OS drive only have been deployed and encryption completed using the MBAM client. When running the compliance report and evaluating using the SCCM client the compliance comes
    back as non-compliant. I have tried several tweaks to the GPO but had no luck getting it to report as compliant. Using the dashboard report to try and pin point why it is non-compliant shows as non-compliant but using the reasons in the top right corner all
    have 0 instances.
    Is there a log file on the local system that can tell me what aspect is causing the status?

    In the Event Viewer, there is MBAM node, you will find all MBAM client events there.
    Also, review your GPO and see what encryption types are allowed and which are required. Maybe one reason would be, that your GPO requires something, which your client hasn´t done yet, like PIN code.
    I´ve seen issues with not being compliant to policy before, and there was some explanations of this, if you google around. I´m also intrested to get knowing this, because I couldn´t solve this compliance issue.
    For customer reporting, I just did query in SCCM where I listed ecrypted status and drive letters, that was a "customized report method" to tell customer, are all their Computers encrypted or not.

  • MBAM 2.5 HelpDesk cannot loggin

    hello
    I installed  MBAM 2.5 on production with
    2 Servers (1 IIS , 1
    SQL).
    groups are correct in the wizard, I
    run the SPN, I am using HTTPS
    certificate for the name of the web portal with an alias
    (not the server name)
    the PC already report and its key is
    stored in the DB, I access SelfService
    but I can not enter HelpDesk after
    asking me authentication credentials.

    Yes.
    the user keyrecov are member of Advanced HelpDesk.
    the user keyweb are member of HelpDesk.
    the users cannot logging to HelpDesk after Windows authentication prompt
    im sure because I have images of Setup and Configuration of MBAM installation.
    -other user can loging to SelfService portal but not to HelpDesk portal.
    -the client PC can save key recov on MBAM server and are encrypted Partitions
         i make a query on SQL DataBase and I see key recov of client computers

  • MBAM 2.5 Unable to find compatible TPM despite TPM available and device encrypted

    We have just installed and are piloting MBAM 2.5. Everything seems to have gone fine, machines are checking in getting policies, encrypting as they are supposed to and we can query MBAM for recovery keys and TPM passwords to do recoveries as needed.
    The only issue we have is when we come to look at the compliance reports we see the following
    Enterprise Compliance report - Machines show 'Unable to find compatible TPM'
    In Computer Compliance report for one of these machines , Protector type is TPM+PIN, Protector state is ON, Encryption State is Encrypted yet compliance status is Non-Compliant.
    TPM is ON, Initialised and is v1.2
    Any suggestions as to why my machines status is non-compliant?

    I was having the same problem with some of my Dell Laptop clients and although the Hotfix did solve the problem, I thought it was worth mentioning the first time the client reported back to MABM after installing the hotfix, only the Compliance Status changed
    from "Non-Compliant" to "Compliant" and the Compliance Status Details still showed "Unable to find compatible TPM". It took one more reporting cycle for the Compliance Status Details  to show "No Error".  I
    would also like to mention there is no indication of anything wrong with these systems in terms of looking at them via the TPM.msc, MBAM Event Log or WMI Win32_Tpm class/properties. The systems encrypt the drive via MBAM normally...they just don't
    report back to the MABM database properly. The computers are running the latest BIOS and I have reset the TPM Security BIOS settings back to their Defaults several times with the same results. Thanks for the hotfix!!!  

  • MBAM 2.5 Reports Fail with "Invalid object name 'v_GS_MBAM_POLICY'."

    Utilizing the SSRS Reports for MBAM 2.5 Integrated into Configuration Manager 2012 R2 Cu3, when I run the reports it states that the view
    'v_GS_MBAM_POLICY'  does not exist.
    The complexing thing though is that there are computers that are reporting the HINV Class called 'Win32Reg_MBAMPolicy'  So I would think this view would have been created.
    Does anyone know the process by which the view gets generated since my HINV is reporting back the information, yet the view has not been created in the DB yet... It makes no sense.
    The error is:
    Microsoft.Reporting.WinForms.ReportServerException
    An error has occurred during report processing. (rsProcessingAborted)
    Stack Trace:
       at Microsoft.Reporting.WinForms.ServerReport.ServerUrlRequest(Boolean isAbortable, String url, Stream outputStream, String& mimeType, String& fileNameExtension)
       at Microsoft.Reporting.WinForms.ServerReport.InternalRender(Boolean isAbortable, String format, String deviceInfo, NameValueCollection urlAccessParameters, Stream reportStream, String& mimeType, String& fileNameExtension)
       at Microsoft.Reporting.WinForms.AsyncMainStreamRenderingOperation.RenderServerReport(ServerReport report)
       at Microsoft.Reporting.WinForms.AsyncRenderingOperation.PerformOperation()
       at Microsoft.Reporting.WinForms.ReportViewer.AsyncReportOperationWrapper.PerformOperation()
       at Microsoft.Reporting.WinForms.ProcessingThread.ProcessThreadMain(Object arg)
    Microsoft.Reporting.WinForms.ReportServerException
    Query execution failed for dataset 'ComplianceDetails'. (rsErrorExecutingCommand)
    Stack Trace:
       at Microsoft.Reporting.WinForms.ServerReport.ServerUrlRequest(Boolean isAbortable, String url, Stream outputStream, String& mimeType, String& fileNameExtension)
       at Microsoft.Reporting.WinForms.ServerReport.InternalRender(Boolean isAbortable, String format, String deviceInfo, NameValueCollection urlAccessParameters, Stream reportStream, String& mimeType, String& fileNameExtension)
       at Microsoft.Reporting.WinForms.AsyncMainStreamRenderingOperation.RenderServerReport(ServerReport report)
       at Microsoft.Reporting.WinForms.AsyncRenderingOperation.PerformOperation()
       at Microsoft.Reporting.WinForms.ReportViewer.AsyncReportOperationWrapper.PerformOperation()
       at Microsoft.Reporting.WinForms.ProcessingThread.ProcessThreadMain(Object arg)
    Microsoft.Reporting.WinForms.ReportServerException
    Invalid object name 'v_GS_MBAM_POLICY'.
    Stack Trace:
       at Microsoft.Reporting.WinForms.ServerReport.ServerUrlRequest(Boolean isAbortable, String url, Stream outputStream, String& mimeType, String& fileNameExtension)
       at Microsoft.Reporting.WinForms.ServerReport.InternalRender(Boolean isAbortable, String format, String deviceInfo, NameValueCollection urlAccessParameters, Stream reportStream, String& mimeType, String& fileNameExtension)
       at Microsoft.Reporting.WinForms.AsyncMainStreamRenderingOperation.RenderServerReport(ServerReport report)
       at Microsoft.Reporting.WinForms.AsyncRenderingOperation.PerformOperation()
       at Microsoft.Reporting.WinForms.ReportViewer.AsyncReportOperationWrapper.PerformOperation()
       at Microsoft.Reporting.WinForms.ProcessingThread.ProcessThreadMain(Object arg)
    David Baur

    We ran into this error as well. Turns out that MBAM-provided reports to SCCM 2012 fail with an error unless the Win32Reg_MBAMPolicy class is added to SCCM, which also updates the SCCM SQL with required Views, including "v_GS_MBAM_POLICY".
    The solution that we finally came up with was to import an updated MOF file to include the BitLocker Policy (Win32Reg_MBAMPolicy) class into the "Hardware Inventory" section of the Default Client Policy. Once the import is complete SQL also gets
    the appropriate view created.
    The instructions on how to create and import the MOF file can be found in the link below.
    http://technet.microsoft.com/en-US/library/dn237295.aspx
    Chris Keene
    Product Specialist at Wave.

  • SCCM Query for any PC with 2 partitions?

    I'm trying to find a query that will allow me to tell any computer in our network that has 2 partitions.  When we deploy our Win7 through SCCM it has only the 1 partition and doesn't have the 100MB partition that is created if you install via a CD. 
    Problem is we have some old 7 computers that we need to find to change the way we deploy bitlocker and MBAM through SCCM and if i can find the ones with 2 partitions then I'll have a much easier job.  Does anyone know how to do that via SCCM?

    Hi, This query will list all computers with a disk 0 parition 1, that should mean they have two partitions. I got some strange result on one of my HP Laptops though which had 4, But you could give it a try.
    select SMS_R_System.Name, SMS_G_System_PARTITION.DeviceID from SMS_R_System inner join SMS_G_System_PARTITION on SMS_G_System_PARTITION.ResourceId = SMS_R_System.ResourceId where SMS_G_System_PARTITION.DeviceID = "Disk #0, Partition #1"
    Regards,
    jörgen
    -- My System Center blog ccmexec.com -- Twitter @ccmexec

  • Error while running a query-Input for variable 'Posting Period is invalid

    Hi All,
    NOTE: This error is only cropping up when I input 12 in the posting period variable selection. If I put in any other value from 1-11 I am not getting any errors. Any ideas why this might be happening?
    I am getting the following error when I try and run a query - "Input for variable 'Posting Period (Single entry, mandatory)' is invalid" - On further clicking on this error the message displayed is as follows -
    Diagnosis
    Variable Posting Period (Single Value Entry, Mandatory) is used as a lower limit (X) and an upper limit () in an interval selection. This limit has the value #.
    System Response
    Procedure
    Enter a different value for variable Posting Period (Single Value Entry, Mandatory). If the value of the other limit is determined by another variable, you can change its value also.
    Procedure for System Administration

    OK.
    Well, if the variable is not used in any interval selection, then I would say "something happened to it".
    I would make a copy of the query and run it to check if I get the same problem with period 12.
       -> If not, something is wrong in the original query (you can proceed as below, if changes to original are permitted).
    If so, then try removing the variable completely from the query and hardcode restriction to 12.
       -> If problem still persists, I would have to do some thinking.
    If problem is gone, then add the variable again. Check.
       -> If problem is back, then the variable "is sick". Only quick thing to do, is to build an identical variable and use that one.
    If problem also happens with the new variable, then it's time to share this experience with someone else and consider raising an OSS.
    Good luck!
    Jacob
    P.S: what fisc year variant are you using?
    Edited by: Jacob Jansen on Jan 25, 2010 8:36 PM

  • Logical database in adhoc query

    Hello All,
    Can anyone tell me what is the logical database in adhoc query?

    Hi
    When you create a query , you have to select an infoset. Infoset can be considered as a source from which data is populated in the Query Fields.
    Infosets are created from Transaction SQ02.
    There can be four methods through which an Infoset can become a source of data:
    1.  Table join ( By joining two or more tables from Data dictionary)
         example: Joining tables PA0001 and PA0006 on Pernr to get a one resultant dataset
    2. Direct read of Basis Table ( Like PA0001 as a source for data in Infoset )
    3. Logical Database ( A Pre-written Program by SAP that extract data from clusters, tables taking care of authorizations and validity periods)
    Example : Logical database PNP, PNPCE (Concurrent Employement),PCH ( LDB for Personnel Development Data)
    Custom Logical DBs can be created in T_Code SE-36.
    4. Data Retrieval by a Program ( Custom code written by ABAP developers which will collect and process data) . This program has a corresponding Structure in data dictionary and the fields of this structure will be used in query)
    Reward Points, if helpful.
    Regards
    Waseem Imran

  • Query help on Goods Receipt Query with AP Invoice

    Looking for a little help on a query.  I would like to list all the goods receipts for a given date range and then display the AP Invoice information (if its been copied to an AP Invoice).  I think my problem is in my where clause, I plagerized an SAP query to show GR and AP from a PO as a start.  SBO 2005 SP01.  Any help would be great appreciated.  Thanks
    SELECT distinct 'GR',
    D0.DocStatus,
    D0.DocNum ,
    D0.DocDate,
    D0.DocDueDate,
    D0.DocTotal,
    'AP',
    I0.DocStatus,
    I0.DocNum ,
    I0.DocDate,
    I0.DocDueDate,
    I0.DocTotal,
    I0.PaidToDate
    FROM
    ((OPDN  D0 inner Join PDN1 D1 on D0.DocEntry = D1.DocEntry)
    full outer join
    (OPCH I0 inner join PCH1 I1 on I0.DocEntry = I1.DocEntry)
    on (I1.BaseType=20 AND D1.DocEntry = I1.BaseEntry AND D1.LineNum=I1.BaseLine))
    WHERE
    (D1.BaseType=22 AND D1.DocDate>='[%0]' AND D1.DocDate<='[%1]')
    OR (I1.BaseType=20 AND I1.BaseEntry IN
    (SELECT Distinct DocEntry
    FROM PDN1 WHERE BaseType=22 AND DocDate>='[%0]' AND DocDate<='[%1]'))

    Hi Dalen ,
    I  believe it is because of the condition
    (D1.BaseType=22 AND D1.DocDate>='%0' AND D1.DocDate<='%1')
    OR (I1.BaseType=20 AND I1.BaseEntry IN
    (SELECT Distinct DocEntry FROM PDN1 WHERE PDN1.BaseType=22 AND DocDate>='%0' AND DocDate<='%1'))
    Try changing
    D1.BaseType=22 OR D1.DocDate>='%0' AND D1.DocDate<='%1
    PDN1.BaseType=22 OR DocDate>='%0' AND DocDate<='%1'))
    Lets see what would be the result . Lets have some fun with troubleshooting
    See what would be the difference in the result .
    Thank you
    Bishal

  • Can you check for data in one table or another but not both in one query?

    I have a situation where I need to link two tables together but the data may be in another (archive) table or different records are in both but I want the latest record from either table:
    ACCOUNT
    AccountID     Name   
    123               John Doe
    124               Jane Donaldson           
    125               Harold Douglas    
    MARKETER_ACCOUNT
    Key     AccountID     Marketer    StartDate     EndDate
    1001     123               10526          8/3/2008     9/27/2009
    1017     123               10987          9/28/2009     12/31/4712    (high date ~ which means currently with this marketer)
    1023     124               10541          12/03/2010     12/31/4712
    ARCHIVE
    Key     AccountID     Marketer    StartDate     EndDate
    1015     124               10526          8/3/2008     12/02/2010
    1033     125               10987         01/01/2011     01/31/2012  
    So my query needs to return the following:
    123     John Doe                        10526     8/3/2008     9/27/2009
    124     Jane Donaldson             10541     12/03/2010     12/31/4712     (this is the later of the two records for this account between archive and marketer_account tables)
    125     Harold Douglas               10987          01/01/2011     01/31/2012     (he is only in archive, so get this record)
    I'm unsure how to proceed in one query.  Note that I am reading in possibly multiple accounts at a time and returning a collection back to .net
    open CURSOR_ACCT
              select AccountID
              from
                     ACCOUNT A,
                     MARKETER_ACCOUNT M,
                     ARCHIVE R
               where A.AccountID = nvl((select max(M.EndDate) from Marketer_account M2
                                                    where M2.AccountID = A.AccountID),
                                                      (select max(R.EndDate) from Archive R2
                                                    where R2.AccountID = A.AccountID)
                   and upper(A.Name) like parameter || '%'
    <can you do a NVL like this?   probably not...   I want to be able to get the MAX record for that account off the MarketerACcount table OR the max record for that account off the Archive table, but not both>
    (parameter could be "DO", so I return all names starting with DO...)

    if I understand your description I would assume that for John Dow we would expect the second row from marketer_account  ("high date ~ which means currently with this marketer"). Here is a solution with analytic functions:
    drop table account;
    drop table marketer_account;
    drop table marketer_account_archive;
    create table account (
        id number
      , name varchar2(20)
    insert into account values (123, 'John Doe');
    insert into account values (124, 'Jane Donaldson');
    insert into account values (125, 'Harold Douglas');
    create table marketer_account (
        key number
      , AccountId number
      , MktKey number
      , FromDt date
      , ToDate date
    insert into marketer_account values (1001, 123, 10526, to_date('03.08.2008', 'dd.mm.yyyy'), to_date('27.09.2009', 'dd.mm.yyyy'));
    insert into marketer_account values (1017, 123, 10987, to_date('28.09.2009', 'dd.mm.yyyy'), to_date('31.12.4712', 'dd.mm.yyyy'));
    insert into marketer_account values (1023, 124, 10541, to_date('03.12.2010', 'dd.mm.yyyy'), to_date('31.12.4712', 'dd.mm.yyyy'));
    create table marketer_account_archive (
        key number
      , AccountId number
      , MktKey number
      , FromDt date
      , ToDate date
    insert into marketer_account_archive values (1015, 124, 10526, to_date('03.08.2008', 'dd.mm.yyyy'), to_date('02.12.2010', 'dd.mm.yyyy'));
    insert into marketer_account_archive values (1033, 125, 10987, to_date('01.01.2011', 'dd.mm.yyyy'), to_date('31.01.2012', 'dd.mm.yyyy'));
    select key, AccountId, MktKey, FromDt, ToDate
         , max(FromDt) over(partition by AccountId) max_FromDt
      from marketer_account
    union all
    select key, AccountId, MktKey, FromDt, ToDate
         , max(FromDt) over(partition by AccountId) max_FromDt
      from marketer_account_archive;
    with
    basedata as (
    select key, AccountId, MktKey, FromDt, ToDate
      from marketer_account
    union all
    select key, AccountId, MktKey, FromDt, ToDate
      from marketer_account_archive
    basedata_with_max_intervals as (
    select key, AccountId, MktKey, FromDt, ToDate
         , row_number() over(partition by AccountId order by FromDt desc) FromDt_Rank
      from basedata
    filtered_basedata as (
    select key, AccountId, MktKey, FromDt, ToDate from basedata_with_max_intervals where FromDt_Rank = 1
    select a.id
         , a.name
         , b.MktKey
         , b.FromDt
         , b.ToDate
      from account a
      join filtered_basedata b
        on (a.id = b.AccountId)
    ID NAME                     MKTKEY FROMDT     TODATE
    123 John Doe                  10987 28.09.2009 31.12.4712
    124 Jane Donaldson            10541 03.12.2010 31.12.4712
    125 Harold Douglas            10987 01.01.2011 31.01.2012
    If your tables are big it could be necessary to do the filtering (according to your condition) in an early step (the first CTE).
    Regards
    Martin

  • Query help : Query to get values SYSDATE-1 18:00 hrs to SYSDATE 08:00 hrs

    Hi Team
    I want the SQl query to get the data for the following comparison : -
    Order Created is a Date Column , and i want to find out all the values from (SYSDATE-1) 18:00 hours to SYSDATE 08:00 hours
    i.e.
    (SYSDATE-1) 18:00:00 < Order.Created < SYSDATE 08:00:00.
    Regards

    Hi, Rohit,
    942281 wrote:
    If i want the data in the below way i.e.
    from (SYSDATE-1) 18:00 hours to SYSDATE 17:59 hours ---> (SYSDATE-1) 18:00:00 < Order.Created < SYSDATE 07:59:00.If you want to include rows from exactly 18:00:00 yesterday (but no earlier), and exclude rows from exatly 08:00:00 today (or later), then use:
    WHERE   ord_dtl.submit_dt  >= TRUNC (SYSDATE) - (6 / 24)
    AND     ord_dtl.submit_dt  <  TRUNC (SYSDATE) + (8 / 24)
    So can i use the below format : -
    ord_dtl.submit_dt BETWEEN trunc(sysdate)-(6/24) and trunc(sysdate)+(7.59/24) . Please suggest . .59 hours is .59 * 60 * 60 = 2124 seconds (or .59 * 60 = 35.4 minutes), so the last time included in the range above is 07:35:24, not 07:59:59.
    If you really, really want to use BETWEEN (which includes both end points), then you could do it with date arithmentic:
    WHERE   ord_dtl.submit_dt  BETWEEN  TRUNC (SYSDATE) - (6 / 24)
                      AND         TRUNC (SYSDATE) + (8 / 24)
                                               - (1 / (24 * 60 * 60))but it would be simpler and less error prone to use INTERVALs, as Karthick suggested earlier:
    WHERE   ord_dtl.submit_dt  BETWEEN  TRUNC (SYSDATE) - INTERVAL '6' HOUR
                      AND         TRUNC (SYSDATE) + INTERVAL '8' HOUR
                                               - INTERVAL '1' SECONDEdited by: Frank Kulash on Apr 17, 2013 9:36 AM
    Edited by: Frank Kulash on Apr 17, 2013 11:56 AM
    Changed "- (8 /24)" to "+ (8 /24)" in first code fragment (after Blushadown, below)

  • Query help, subtract two query parts

    Hi,
    I am beginner of PL/SQL and have a problem I couldn’t solve:
    Table (op_list):
    Item     -     Amount -     Status
    Item1     -     10     -     in
    Item2     -     12     -     in
    Item3     -     7     -     in
    Item1     -     2     -     out
    Item2     -     3     -     out
    Item1     -     1     -     dmg
    Item3     -     3     -     out
    Item1     -     2     -     out
    Item2     -     5     -     out
    Item2     -     2     -     in
    Item3     -     1     -     exp
    Would like to get result of query (subtract amount of 'out/dmg/exp' from 'in' ):
    Item - Amount left
    Item1     -     5
    Item2     -     6
    Item3 -     3
    I wrote code that returns sum of all incoming items and sum all out/dmg/exp items, but couldn’t solve how to subtract one part of querry from another. Or maybe there is a better way. Also worried what happens if there is no 'out/dmg/exp' only 'in'
    select item.name, sum(op_list.item_amount)
    from op_list
    inner join item
    on op_list.item = item.item_id
    where op_list.status = 'in'
    group by item.name
    union
    select item.name, sum(op_list.item_amount)
    from op_list
    inner join item
    on op_list.item = item.item_id
    where op_list.status = 'out'
    or op_list.status = 'dmg'
    or op_list.status = 'exp'
    group by item.name
    Return:
    Item1     -     10      [10 in]
    Item1     -     5     [2+1+2]
    Item2     -     14     [12+2]
    Item3     -     7
    Item3     -     4     [3+1]
    Thanks in advance

    Hi,
    We can also use simple inline views to get what we need.
    select a.item,a.amount-b.amount Balance from
    (select item,sum(amount) Amount from op_list
    where status = 'in'
    group by item) a,
    (select item,sum(amount) Amount from op_list
    where status in ('out','dmg','exp')
    group by item) b
    where
    a.item=b.item
    order by item;
    ITEM       BALANCE
    Item1                      5
    Item2                      6
    Item3                      3Regards,
    Prazy

Maybe you are looking for

  • I have an old Mac OS X 10.6.8.

    I have an old Mac OS X 10.6.8.  I got an email from my bank saying they no longer supported my browser and I need to update, but I don't know how to do that or what is safe to do without messing up my computer.  Any suggestions would be helpful.  Tha

  • Can we launch Crystal Report via Browser?

    Hi, Experts I have created a Balance Sheet report (T-Style) with the help of BOBJ-Crystal Reorts. But I wanna to consume this report via Browser, neither email with PDF/Excel attached, nor Crystal Report 2008 designer. Is there any solution/tool to m

  • ISCSI traffic running across Cisco 3750 Switches

    My customer has a small shop with 2 servers runnig iSCSI to a SAN device. They are looking for a switch recommendation and I would like to use a pair of Cisco 3750's, to take advantage of the VSS technology for redundancy,L3 and some other Core requi

  • Forms and Reports 10g run on the other client machine

    Dear Sir, Please tell me how to run forms/reports which is compiled/build in ORACLE 10g. I mean that I have build some forms and reports in Oracle 10g now I want to run them on another client machine without creating oracle application server. Is the

  • Is there a way to add text to converted filename?

    First I wanna say, I just LOOOVE the New Media Encoder CS5.5! I want to add a text to a bunch of files ip converting such as: [(sourcename)] + ["ProRes422 25fps"] So say the original file names are: MVI_1459.mov MVI_1460.mov MVI_1461.mov so after exp