How to Filter a filtered Query with in a single query

Hi all,
Thanks in advance , Below is the query
SELECT *
FROM
(SELECT MitarbeiterListe.IDMITARBEITERLISTE,
MITARBEITERLISTE.JAHR ,
MITARBEITERLISTE.mitarbeiter ,
FIRMA.FIRMA ,
Abteilung.Abteilung ,
MitarbeiterStatus.mitarbeiterstatus ,
MitarbeiterListe.OEVON ,
MitarbeiterListe.OEBIS ,
MitarbeiterListe.SAPPERSNR ,
MitarbeiterListe.EKPreis
||'.00' "MitarbeiterListe.EKPreis",
MitarbeiterListe.InfrastrukturkostenZuschlag
||'.00' "InfrastrukturkostenZuschlag",
MitarbeiterListe.VerwaltungskostenZuschlag*100
||'%' "VerwaltungskostenZuschlag",
MitarbeiterListe.Tagessatz ,
MitarbeiterListe.Arbeitsort ,
MitarbeiterListe.Titel ,
MitarbeiterListe.Bemerkung ,
BERECHTIGUNGEN.BENUTZERNAME
FROM Firma
INNER JOIN (Abteilung
INNER JOIN MitarbeiterListe
ON Abteilung.IDAbteilung = MitarbeiterListe.IDAbteilung
INNER JOIN MitarbeiterStatus
ON MitarbeiterListe.IDMITARBEITERSTATUS=MitarbeiterStatus.IDMITARBEITERSTATUS
INNER JOIN BERECHTIGUNGEN
ON MITARBEITERLISTE.IDBEARBEITER=BERECHTIGUNGEN.IDBENUTZER )
ON Firma.IDFirma = MitarbeiterListe.IDFirma
WHERE MitarbeiterListe.Jahr = :P9_SEL_JAHR
AND Abteilung.IDOE =
( SELECT IDOE FROM OE WHERE OE = :P9_SEL_OE AND JAHR = :P9_SEL_JAHR
) temp
Requirement is : we need to filter this query again based on column in select list . As using AND / OR operator we are not able to give desired result ..
As in our case we are filtering the above query based on :P9_SEL_JAHR and :P9_SEL_OE variables ther is further requirement that we can also filter the filtered given query based on column vaue so we can get the specific columns value through bind variables and can use OR operator between them .but the problem is coming on merging the columns where case with the given query ..
As for example if we use this afer the query
OR/AND
MitarbeiterStatus.mitarbeiterstatus = :P9_SL_MA_STAT OR
MitarbeiterListe.OEVON = :P9_SL_OEVON OR
MitarbeiterListe.OEBIS = :P9_SL_OEBIS OR
MitarbeiterListe.SAPPERSNR = :P9_SL_SAPPERNR
for the OR case the first query will be always true so it will not filter it baseed on column value and in case of AND the second query would return true ..so we would get filtered column value based on column bind varaible not the complete query result based on JAHR and OE bind variable.
any way to satisfy these two cases within a single query ..suggesstions are welcomed and would be truly appreciated.
Cheers
sachin

Not certain I've fully understood your required logic without examples, but I think you just need to use brackets:
WHERE MitarbeiterListe.Jahr = :P9_SEL_JAHR
AND Abteilung.IDOE =
( SELECT IDOE FROM OE WHERE OE = :P9_SEL_OE AND JAHR = :P9_SEL_JAHR)
AND
MitarbeiterStatus.mitarbeiterstatus = :P9_SL_MA_STAT
OR MitarbeiterListe.OEVON = :P9_SL_OEVON
OR MitarbeiterListe.OEBIS = :P9_SL_OEBIS
OR MitarbeiterListe.SAPPERSNR = :P9_SL_SAPPERNR
)

Similar Messages

  • How to filter a sharepoint list with report parameters

    Hello there,
    I'm trying to make a sql report on a sharepoint library. I have no problems to connect to the library but i cannot find a way to filter my data source with report parameters. I've searched on the net a lot, found some stuffs about xml but nothing that shows
    how to do it with sharepoint. Any help would be greatly appreciated!
    Thanks in advance!

    Hi mgarant,
    As you mentioned, by default, we can use xml parameter "query" to filter a SharePoint list from SQL Server Reporting Services. We can also modify the value for the "query" to use SQL Server Reporting Serivces parameters to filter the SharePoint list.
    Below are the detailed steps for your reference:
     1.Change the query string to be a string like this:
    <Query>
    <SoapAction>http://schemas.microsoft.com/sharepoint/soap/GetListItems</SoapAction>
    <Method Namespace="http://schemas.microsoft.com/sharepoint/soap/" Name="GetListItems">
    <Parameters>
    <Parameter Name="listName">
    <DefaultValue>{ADBE55DB-63A1-4C14-9DA0-B1B05C13B4C8}</DefaultValue>
    </Parameter>
    <Parameter Name="query" Type="xml">
    </Parameter>
    </Parameters>
    </Method>
    <ElementPath IgnoreNamespaces="true">*</ElementPath>
    </Query>
     2.In the dataset modification dialog, go to "Parameters" tab.
     3.Create a Report Parameter(e.g. CityParam).
     4.In parameter tab, create a parameter with:
    Name: query
    Value: ="<Query>
       <Where>
          <Eq>
             <FieldRef Name='WorkCity' />
             <Value Type='Text'>" & Parameters!CityParam.Value & "</Value>
          </Eq>
       </Where>
    </Query>"
    Please note, “case sensitive” is required. In this case, the parameter name for "query" must be in lower case. WorkCity is name of a field in the SharePoint list.
    For more information about how to retrieve value from SharePoint list, I would suggest you reading the following article and threads:
    http://vspug.com/dwise/2007/11/28/connecting-sql-reporting-services-to-a-sharepoint-list-redux/
    http://blogs.msdn.com/mariae/archive/2007/12/13/querying-sharepoint-list-from-reporting-services-returns-only-not-null-columns.aspx
    I also implemented a sample, you could download it from:
    http://cid-3c7e963ff6ccd974.office.live.com/browse.aspx/.Public/SharePoint%20List%20sample?uc=2
    Please feel free to ask, if you have any more questions.
    Thanks,
    Jin Chen
    Jin Chen - MSFT

  • How to filter standard ALV report with custom UI element?

    Hello Expert,
    I got a requirement to filter standard ALV report based on the custom UI element (which is created in the screen before displaying the ALV report). Upon entering the values in the Custom field, the ALV report is displayed accordingly.
    Any ideas how to approach it?
    Thanks,
    Mohammed

    Hi,
    Okay, let me explain the steps in detail
    Let us say you have alv table with 10 records and alv table is shown first time with all 10 records
    Create an internal table in component controller's attribute GT_ORIGINAL_DATA and save all 10 records into this table first time
    Now, user enters value in FILTER_MATNR field 123 and press apply_filter button or press enter key
    Read the value of field filter_matnr and get the only matching records from global internal table GT_ORIGINAL_DATA into local internal table as below
              data lv_matnr type matnr.
              data lt_data   like wd_comp_controller->gt_original_data.
                   " read the value from context attribute of filter_matnr
                        lv_matnr = ???
                   " copy all data into local table
                        lt_data[] = wd_comp_controller->gt_original_data.
                   "delete the records which does not match
                     delete lt_data where matnr NP lv_matnr.
    Now, bind the data lt_data to context node of alv table
    Hope this helps you.
    Regards,
    Rama

  • How create filter in olap universe with MDX LIKE Function

    Hi all
    I need to create a filter in a olap universe with the LIKE MDX function.
    Problem:
    There is a dimension with account numbers whit 10 digits like this: 5683492703 and i need to create a filter whit all account numbers whit the number 7 in the sixth position in a olap universe.
    How to do this?
    Thanks all

    Try like this :
    <FILTER KEY="[Level Object Definition]">
         <CONDITION OPERATORCONDITION="Like">
              <CONSTANT CAPTION="_____7*"/>
         </CONDITION>
    </FILTER>
    Not sure if it is _ or ? to represent a single character. Try ? in place of _ if the above code doesn't work.
    Regards

  • How to use Web Filters methodology  with Internal ITS with NW2004s

    ITS 6.2 will no longer be supported going forward with the upcoming NW2004s. Only internal ITS will be supported with 2004s. However, since PAS APIs are not available with Internal ITS, Can any one give some clue on how we can use the Web Filters methodology for use with Internal ITS with 2004s.

    A long time ago, but yesterday i have had time to try again to setup the MacMini server properly. But no luck.
    sudo changeip -checkhostname
    gives me:
    Primary address          = 192.168.1.** (i don't know it's save enough to put this IP complete on the net)
    Current HostName      = server.beeldenstorm.be
    The DNS hostname is not available, please repair DNS and re-run this tool.
    dirserv:success           = "success"
    So their is something wrong. But how to repair the DNS?
    MacMini server is working properly on our local network, but outside not. I have done the port forwarding.
    Another problem is that i have read that for the server to work properly we have to use fix IP address.
    So, that's what i am doing. But in that way their is no internet connection at all.
    So, no updates and ... .
    Lookup and Ping test, outside our local network:
    http://beeldenstorm.be/doc/lookup-and-ping.pdf
    Why is this so irritating and are there soo many problems on forums?
    I know: because most of us are not network/server specialists.
    But Apple sells this server app like a app for everybody, easy to install?
    Thanks for help.

  • How to filter with a mandatory varible in a bi query

    Hi,
    I've a bi query with the mandatory variable 'Fiscal Year / Period' and I'd like to make a VC iview which asks an initial date (From) and an ending date and that returns any value of my query.
    Can anybody explains me how to do this?  or, some link related to it.
    Thanks in advance.
    Regards.

    Hi,
    Please find the URL:
    http://help.sap.com/saphelp_nw70/helpdata/en/42/c2ba85545e3116e10000000a1553f7/frameset.htm
    Navigation:
    Expand: Core Development Tasks -> How to... -> Work with SAP BI System -> Working with Variables.
    This is the best guide.
    Regards,
    Ravindranath

  • How to set this filters with 'or' relationship

    Hi Pros,
          I have a query as follows, rows and columns are all in structures.
                                                       regular_employees
                 active_employees
                 lay_off_employees
         I want to set up filter as ' employ_status = 0 or employ_subgroup =2' for this query, please tell me how to set this filters with 'or' relationship.

    Hi Yifei,
    Create a formula and enter this (let's name this FORMULA_KF):
    ((EMPLOY_STATUS = 0) OR (EMPLOY_SUBGROUP = 2)) * enter value IF_TRUE + enter value IF_FALSE
    Then create the condition to HIDE the rows having those values to be filtered (if this is your purpose)..
    Like,
    FORMULA_KF <> 1
    Is this what you want mate?
    Regards,
    Loed

  • How do I use the Parameters from URL to filter on Content Query in ItemStyle.xsl?

    Hi, I might need your help with code that Content Query under <xsl:Template...> that I need a filter for 3 parameter from url (from date, to date(for date range) and type.
    eg: www.mywebsite.com/pages/Filter.aspx?DateFrom=01/01/2012&DateTo=01/01/2013&Type=sports
    I've google for help and not sure they seem working so far.

    Hi,
    If you want to filter a Content Query Web Part with the parameters from URL, we can achieve it with OOTB of Content Query Web Part by adding "Additional Filters" in "Web Part Properties"->"Query". We can add
    three filters like:
    date is greater than [PageQueryString:DateFrom]
    And
    date is less than [PageQueryString:DateTo]
    And
    type is equal to [PageQueryString:Type]
    Then redirect to the URL: www.mywebsite.com/pages/Filter.aspx?DateFrom=01/01/2012&DateTo=01/01/2013&Type=sports, the query results will be filtered.
    Please reply freely if I misunderstand your meaning or there any other questions.
    best regards
    Patrick Liang
    TechNet Community Support

  • How to filter 2 Dimension on DS with script code

    Hi experts,
    coming from a discussion:
    Not possible to filter for more than one dimension in Datasource script filter method?
    I found necessary to open new discussion.
    I have the following scenario:
    I got a pie chart showing indicator for one dimension coming from BW DS.
    I have DS initialized with:
    On Column
    Indicator -> Oportunity_mesure
    On Row
    Dimension -> type_dimension
    In the dashboard, I need to filter this pie chart with Year/month and Representation Dimensions.
    so on startup I script the follow:
    DS1.setFilter("0CALLMONTH",varMonth);
    DS1.setFilter("ZCREP",varRepr);
    What I'm seen is that I don't get both filters on chart values. Is there a limitation? how can I solve it?
    Thank you very much

    Hi Oscar,
    Your scenario is definitely possible and both filters should be retained.  Can you share the code where you populate the value of the variables varMonth and varRepr?
    Thanks,
    Mustafa.

  • How to filter by attributes with type Strings

    The documentation is not really detailed about setting attributes with type Strings. I assume I've to type each string value in a new line in the set attributes dialog box. This works fine and my XML looks like this<br /><br /><para CMS = "prodA prodB"><br /><br />having set the two string values "prodA" and "prodB".<br /><br />But how to filter these attributes? The filter CMS="prodA" shows my paragraph correctly, but CMS="prodB" does not show this paragraph as it should. Filters seem to match only the first of the set of string values.<br /><br />I would like to show this paragraph in two document versions for these two products prodA and prodB.<br /><br />Framemaker 8.0.3<br /><br />Tilman

    Tilman,
    this is something that AFAIK is not supported by FrameMaker's own attribute based filtering.
    But, without changing your documents, if you install the *free* ABCM (Attribute-based condition management) plug-in from weststreet consulting, you will succeed. Be sure to read the tutorial!
    http://weststreetconsulting.com/
    - Michael

  • How to write a SQL query in SAP B1 2007 B with input parameters?

    How to write a SQL query in SAP B1 2007 B with input parameters, on execution of which will ask for some input value from the user and the values will be selected from a list such as item list?

    The syntax like
    SELECT * FROM OITM T0 WHERE T0.ItemCode = '[%0\]'
    Thanks,
    Gordon

  • How can I create a query with tables in INFOSET?

    Dear Gurus,
    How can I create a query with tables in INFOSET?
    Just tables and fields INFOSET?
    Kind Regards,

    Hello
    Check following SCN Article for your understanding/reference:
    - [Using Infoset Query ,SAP Query and Quick Viewer|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/10eab7af-0e54-2c10-28a5-87b47adbe1a5]
    Regards
    JP

  • How can I create a query with web service data control?

    I need to create a query with web service data control, in WSDL, it's query operation, there is a parameter message with the possible query criteria and a return message contains the results. I googled, but cannot find anything on the query with web service. I cannot find a "Named Criteria" in web service data control like normal data control. In Shay's blog, I saw the topics on update with web service data control. How can I create a query with web service data control? Thanks.

    Hi,
    This might help
    *054.     Search form using ADF WS Data Control and Complex input types*
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/index-101235.html

  • How to create an explain plan with rowsource statistics for a complex query that include multiple table joins ?

    1. How to create an explain plan with rowsource statistics for a complex query that include multiple table joins ?
    When multiple tables are involved , and the actual number of rows returned is more than what the explain plan tells. How can I find out what change is needed  in the stat plan  ?
    2. Does rowsource statistics gives some kind of  understanding of Extended stats ?

    You can get Row Source Statistics only *after* the SQL has been executed.  An Explain Plan midway cannot give you row source statistics.
    To get row source statistics either set STATISTICS_LEVEL='ALL'  in the session that executes theSQL OR use the Hint "gather_plan_statistics"  in the SQL being executed.
    Then use dbms_xplan.display_cursor
    Hemant K Chitale

  • How can I make a query by date with several TDMS files?

    Hi,
    I have a project that can write and read TDMS files everyday (a file for each day with date and time). There, I can import those files to excel (I choose a file and load it). But, I have a question: How can I make a query by date with those TDMS files? I'd like make a time stamp for start date and stop date, where I could compare the TDMS file dates and sum the values that are in the channels where these files are similar. For example, I save a file with "02/01/2013" name, in other day "03/01/2013", in other day "04/01/2013"... so, i'd like put in time stamp for start date "02/01/2013" file and to stop date "04/01/2013" file, than, sum all values that range with my TDMS files existing. How can I make that? 
    Thanks all,
    Val 

    Hello Val_Auto.
    You're Brazilian, no? Me too. = ^ - ^ =
    I converted VI to version of your LabVIEW (8.5). Is attached in this reply.
    This VI search all your TDMS in a range of dates and join them in a single TDMS. I hope this is what you wanted.
    Query TDMS is the main VI. The TDMS VI Search changes the date format that out from calendar control (which is DD / MM / YYYY) to DD-MM-YYYY. This is because you can't name files using "/". I chose "-" but, if necessary, you should change to keep the same format of your TDMS files.
    If you have any doubt as to its operation or how to make changes to adapt VI for your application, keep at your disposal.
    Thank you for your contact; I hope have helped you and succeed in your application.
    Wesley Rocha
    Application Engineer
    National Instruments Brazil
    Visite a nossa comunidade em PORTUGUÊS!!!
    Attachments:
    Query TDMS.vi ‏62 KB
    tdms search.vi ‏24 KB

Maybe you are looking for

  • Preflight panel Info. shows my placed 300 ppi PDFs at much less effective resolution

    Ï'm brand new to InDesign (graphic designer who primarily works in Illustrator, some Photoshop, until now). I understand resolution and PPI but not necessarily in-depth knowledge of the related necessary workflow needed within InDesign, if that makes

  • Sync and async bpel process

    Hi, I was reading about the synchronous and asynchronous process in the forum, I have also some similar problem. some of my questions are: If suppose my BPEL process is going to take around 2 mins or more to finish , then I cannot chose synchronous B

  • IOS 4.2.1 GM won't finish installing (Stuck in DFU)

    I downloaded the latest 4.2.1 GM from the dev center. Running iTunes 10.1 (54). It just gets stuck every time. TinyUmbrella wont kick the phone out of DFU. I also tried modifying the host file. Nothing works. I've had this issue before and sometimes

  • How to Calculate sum for the selected rows in ALV gird using custom button

    Hi I am trying to implement an ALV Grid display where the user can select few rows in the output and if he click on some custom button he should get the sum for only those rows. Can anyone give me some idea regarding this. Thanks in advance

  • FB70 mass upload of invoices

    Dear Experts, We are migrating to a new system and would like to move our open invoices for AR in to the system.  I know we can use FB70 for single invoices.  Problem is that we have 1800 of them.  Is there any way of uploading the mass invoices outs