Joining Tables SQL SCCM Query

Hello Im trying to find all users that have Microsoft Project installed I also need their full name not just their user login. I cant see whats wrong with my SQl query? Any help appreciated. I get "Invalid view" error.
select distinct
SMS_R_System.Name,
SMS_R_System.LastLogonUserName,
SMS_R_System.LastLogonTimestamp,
SMS_R_System.DistinguishedName,
SMS_R_System.operatingSystem,
SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName,
USR.Full_User_name0
from
SMS_R_System
inner join
SMS_G_System_ADD_REMOVE_PROGRAMS on
SMS_G_System_ADD_REMOVE_PROGRAMS.ResourceID = SMS_R_System.ResourceId
inner join
v_r_user as USR on
sys.User_Name0 = USR.User_Name0
where
SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName
like
"%Project%"
order by
SMS_R_System.Name
SCCM Deployment Technician

Ah yes now I understand, thankyou for the tip here is the correct code.
select distinct
SMS_R_System.Name,
SMS_R_System.LastLogonUserName,
SMS_R_System.LastLogonTimestamp,
SMS_R_System.DistinguishedName,
SMS_R_System.operatingSystem,
SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName,
SMS_R_User.FullUserName
from
SMS_R_System
inner join
SMS_G_System_ADD_REMOVE_PROGRAMS on
SMS_G_System_ADD_REMOVE_PROGRAMS.ResourceID = SMS_R_System.ResourceId
inner join
SMS_R_User on
SMS_R_User.UserName=SMS_R_System.LastLogonUserName
where
SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName
like
"%Project%"
order by
SMS_R_System.Name
SCCM Deployment Technician

Similar Messages

  • How to deal with Join Table in SAP Query

    Hi buddy,
    I create a Infoset ZTest by some infotype, one of them is 0185, and 3208.
    In 0185 there is a ICTYP and 3208 also SUBTY, and they are Join by that fields.
    It means, add a new record in P0185 with ICTYP = 'RS', there is a new record add in P3208 automaticly.
    Now, in my SAPQuery, I just need to input a ICTYP, and select the result. It always have unnessary records in output.
    Fg.  in P0185 have two records, ICTYP are 'RS', 'FR', so, in P3208 also have.
    And input 'RS' as input selction paramters, it check the records which ICYTP is RS in P0185, but it won't do the check in P3208, because, in selction screen, it just have P0185-ICTYP.
    So, the output will have problem.
    I want to know how to fix this issue, or add some extra code in the SAPQuery....
    Really thanks .

    hi,
    The pdf below gives the steps to create drill down report.
    http://www.sappoint.com/abap/eis.pdf
    also check.
    <a href="http://72.14.203.104/search?q=cache:k-SFYy_rjPIJ:www.hrexpertonline.com/archive/Volume%252003%2520(2">http://72.14.203.104/search?q=cache:k-SFYy_rjPIJ:www.hrexpertonline.com/archive/Volume%252003%2520(2</a>
    regs,
    jaga

  • Maximum number of tables that can be outer joined with one table in a query

    Hi All,
    Iam new to sql, so can you please let me know What is the maximum number of tables that can be outer joined with one table in a query?
    Thanks,
    Srini

    srinu2 wrote:
    Iam new to sql, so can you please let me know What is the maximum number of tables that can be outer joined with one table in a query?
    There is no limit to the number of tables you can outer join as long as you join them correctly.
    SQL> with a as
      2      (
      3      select 1 id, 2 b_key, 3 c_key from dual union all
      4      select 2 id, 1 b_key, 4 c_key from dual union all
      5      select 3 id, 3 b_key, 1 c_key from dual union all
      6      select 4 id, 4 b_key, 2 c_key from dual
      7      ),
      8      b as
      9      (
    10      select 1 id, 1 c_key2 from dual union all
    11      select 2 id, 5 c_key2 from dual union all
    12      select 3 id, 3 c_key2 from dual union all
    13      select 4 id, 2 c_key2 from dual
    14      ),
    15      c as
    16      (
    17      select 1 key1, 1 key2, '1-1' dta from dual union all
    18      select 1 key1, 2 key2, '1-2' dta from dual union all
    19      select 1 key1, 3 key2, '1-3' dta from dual union all
    20      select 1 key1, 4 key2, '1-4' dta from dual union all
    21      select 2 key1, 1 key2, '2-1' dta from dual union all
    22      select 2 key1, 2 key2, '2-2' dta from dual union all
    23      select 2 key1, 3 key2, '2-3' dta from dual union all
    24      select 2 key1, 4 key2, '2-4' dta from dual union all
    25      select 3 key1, 1 key2, '3-1' dta from dual union all
    26      select 3 key1, 2 key2, '3-2' dta from dual union all
    27      select 3 key1, 3 key2, '3-3' dta from dual union all
    28      select 3 key1, 4 key2, '3-4' dta from dual union all
    29      select 4 key1, 1 key2, '4-1' dta from dual union all
    30      select 4 key1, 2 key2, '4-2' dta from dual union all
    31      select 4 key1, 3 key2, '4-3' dta from dual union all
    32      select 4 key1, 4 key2, '4-4' dta from dual
    33      )
    34  select d.a_id, d.b_id, c.key1 as c_key1, c.key2 as c_key3, c.dta
    35  from
    36      c,
    37      (
    38      select
    39          a.id as a_id, b.id as b_id, a.c_key, b.c_key2
    40      from a, b
    41      where a.b_key = b.id
    42      ) d
    43  where d.c_key = c.key1 (+)
    44  and   d.c_key2 = c.key2 (+);
          A_ID       B_ID     C_KEY1     C_KEY3 DTA
             3          3          1          3 1-3
             4          4          2          2 2-2
             2          1          4          1 4-1
             1          2
    SQL>

  • Can we create prompts in Derived Table sql query

    Hi,
    I am trying to define derived table sql query as below. Though the syntax parsing is going through but when I am generating the report it is throwing and invalid prompt definition error.
    " select * from table_a where call_direction = @Prompt('Enter Call Direction','A','"derivedtable_a".SHORT_STRING',mono,free,not_persistent,) and
    where call_type = @Prompt('Enter Call Direction','A','"derivedtable_b".SHORT_STRING',mono,free,not_persistent,) "
    Can somebody please share your thoughts if this can be achieved in universe or not ?
    Appreciate immediate responses as it is a show stopper for my deliverable.
    Thanks in advance.
    Thanks and Regards,
    Shireen.

    Hi Shireen
    We can use prompt in the derived table. There is issue with the SQL that you have used while creating the Derived Table.
    Instead of using the "derivedtable_a".SHORT_STRING' field use the object from the class on which you are creating the derived table.
    For example: If you are creating a derived table in the sample universe efashion on Agg_yr_qt_rn_st_ln_ca_sr table then use the following query:
    SELECT *
    FROM Agg_yr_qt_rn_st_ln_ca_sr
    WHERE Agg_yr_qt_rn_st_ln_ca_sr.Yr = @Prompt ('Enter Value','C','Time Period\Year',mono,constrained)
    Hope this helps!
    Thanks

  • Can't join tables.query dependency not found "" in EUL

    hi ALL,
    i created one report in disco 3.1.38 and its' running fine but after storing it in database and then again trying to open it from database it gives me error "can't join tables."name of query folder" dependency not found "" in EUL"
    if any one has come across such problem and has solution for it ..please reply back.
    thanks in anticipation
    manish

    Manish,
    I have not run into this error before and maybe one of the oracle consultants could answer this better. But I here it goes. I would first try a refresh on the folders that the report in question is using. Is it possible that the under lining tables have changed? Do you have another copy of the same report outside of the database and does it still work?
    Christopher

  • Joining tables with SQL in Crystal XI

    I am new to Crsytal Reports. I want to join 2 tables using a formula, which I am trying to do in SQL. I created a simple test report and I can get it to work if I don't put any fields on the report from the joined table.  ie  -  if I just use fields from "sal-rep" the report works.  As soon as I add a field from "freight" (my joined table) the report will not display anything.  (but I don't get any error messages - just a blank report).  Here is my SQL: 
    SELECT "sal-rep"."full-name","sal-rep"."invoice-nbr","freight"."misc-charge-ammount"  FROM   "PUB"."sal-rep" INNER JOIN "PUB"."FREIGHT" ON ("sal-rep"."invoice-nbr"="freight"."invoice-nbr")  WHERE  "sal-rep"."invoice-nbr"='0000189957'

    I got it to work!!!   This is the SQL I used -
    SELECT "sal_rep"."full-name", "sal_rep"."invoice-nbr", "freight"."misc-charge-ammount", "freight"."invoice-date"
    FROM   "PUB"."freight" "freight" INNER JOIN "PUB"."sal-rep" "sal_rep" ON ("freight"."invoice-nbr"="sal_rep"."invoice-nbr") AND ("freight"."invoice-date"="sal_rep"."inv-date")
    WHERE  "sal_rep"."invoice-nbr"='0000189957'
    Now when I look at the Table used in Database expert it lists -  Command and Freight.
    Before it was listing Command and Sal-Rep. 
    Not sure I understand why, but at least it's working.
    thanks for your help - really appreciated!

  • Can we join two totals tables in ABAP Query

    Hey Gurus!
    Can we join two totals tables in ABAP query.
    I am tyring to join FAGFLEXT with internal orders totals table.
    Thanks
    S

    Hi,
    Report painter majorily operates around characteristics and key figures.
    ABAP query comes even more handy.  The advantage is -
    1. You can link many tables
    2. Create selection screen as you like to have
    3. User friendly report creation
    4.  Logic can also be coded.
    5. Authorization can be set
    I have written a article in SDN, which gives you an idea as to how to go about using ABAP query.  Have a look on this - [Article - Practical Usage of ABAP Query|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/20f6b256-23be-2b10-8b93-cad83a617634]
    Regards,
    Sridevi

  • SAP QUERY(SQ03/02/02) - how to join tables

    Hi MM Wizards,
    I would like to know how to join tables EINE & A017 through SAP Query?
    Thanks,
    Kaveri

    Hi Kaveri,
    A017 is a pooled table.  SAP Query does not support joins against Pooled tables.  You should stick to transparent tables if you want to use Query.
    You can do a direct read of A017, but you will just end up with a glorified SE16 display.
    You could have a programmer write some ABAP and place it into the 'extras' section in SQ02 to grab the additional data that you want, but once you have decided to enlist the aid of an ABAPer, it is better just to write a custom Z program from scratch.
    Regards,
    DB49

  • Sql statement for join tables

    hi there..i need ur helps
    Here are my tables n column name for each tables
    a) rep_arrngt
    Name
    REP_ARRNGT_ID
    REP_ARRNGT_DESC
    REP_ARRNGT_TYPE
    ACCT_CAT
    DEF_INDUSTRY_CODE
    MEDIA_ID
    LANGUAGE_ID
    CURRENCY
    PAGE_ID
    b) bci_rep_arrng
    Name
    REP_ARRNGT_ID
    BCI
    SUB_SUM_CODE
    DP_SUB_SUM_CODE
    c) acct_rep_arrngt_link
    Name
    ACCT_NO
    REP_ARRNGT_ID
    DOC_TYPE
    LAST_BILL_DATE
    BILL_FREQUENCY
    SCALING
    EFF_FROM_DATE
    EFF_TO_DATE
    MEDIA_ID
    Actually, i want to get the unique value for sub_sum_code according to the bci..
    i already use join tables n here is my sql statement :
    SELECT T1.SUB_SUM_CODE,T1.BCI,T1.REP_ARRNGT_ID,T2.REP_ARRNGT_ID,T3.REP_ARRNGT_ID FROM BCI_REP_ARRNG T1, REP_ARRNGT T2, ACCT_REP_ARRNGT_LINK T3 WHERE T1.REP_ARRNGT_ID=T2.REP_ARRNGT_ID AND T2.REP_ARRNGT_ID=T3.REP_ARRNGT_ID AND BCI='TTA00F06'
    n my results is :
    SUB_SUM_CODE BCI REP_ARRNGT_ID
    TBGSR TTA00F06 R1
    TBGSR TTA00F06 R1
    TBGSR TTA00F06 R1
    TBGSR TTA00F06 R1
    I get the repeated results for sub_sum_code..
    so, what i need to do if i want only 1 row results like this :
    [u]SUB_SUM_CODE BCI REP_ARRNGT_ID
    TBGSR TTA00F06 R1
    i try to use group by, but i get the error..plz help me

    If you only want "to get the unique value for sub_sum_code according to the bci" then why are you joining the tables in the first place? Not knowing PKs etc you could just use DISTINCT in your select statement.
    SELECT DISTINCT T1.SUB_SUM_CODE,
                    T1.BCI
    FROM BCI_REP_ARRNG T1
    AND BCI='TTA00F06'

  • How to get second maximum salary from employee table(sql query)

    how to get second maximum salary from employee table(sql query)

    dude there is no matter of structure .........that user already said its from employee table ...............its basic table in sql and there is no need to specify the table structure
    .........i think u got my point I think you are the one who didn't understand Sarma's point.
    Give a man a fish and you feed him once. Teach a man how to fish and you feed him a life long.
    >
    and the query is
    select max(sal) from emp where sal<(select max(sal)
    from emp);
    this will give the 2nd max salary from the emp tableBtw: You solution is bad, because it needs to scan and sort the table emp twice. And a better solution has been given already.
    Message was edited by:
    Sven W. - reordered statements

  • Join with another table in pre-query

    Hi,
    We have a large data block and we need to order some columns based on street name for example, not id. The base table of db block contains an id_street column, and 'streets' table contains id and name.
    Ok, in pre-query trigger of that block, we have a complex logic and we dynamically build the where clause. At the end, we set the order_By clause of the block, to order the rows, for example we need to order by the 'my_date' column asc (it's a date type column), and street desc; but street NAME, not id. We don't want to use a from clause query, because the dynamically where clause logic it's complex.
    How can we join the db block table with 'streets' table in pre-query, so when constructing the order by clause to specify something like
    set_block_property('ADRESE_NEZONATE', order_by, 'my_date, name desc');where 'name' is the name of the street, from the 'streets' table.
    Is it possible in pre-query, somehow? Or, in my case where can I join with that table and use that column in pre-query at setting order by?
    Thanks!
    Edited by: Roger25 on 26.04.2013 12:31

    I understand what you say but partially.. please explain in more detail how to do that;
    How should look the adrese_nezonate block, then? I have to add a 'name' column and set copy value from item property to 'STREETS.NAME', and database_property No?
    Then the post-query trigger how should look like (the order by clause)? The post-query sends the entire query (with where/order by clauses) to the server, but in that "select... where... order by" (built dynamically) there are only columns from that block (adrese_nezonate). I need to join with streets, INSIDE that query.
    Thanks.

  • What is the better way to join table for ASE 12.5?

    To join table with T-SQL, there are 2 options:
    select * from tab1 a join tab2 b on a.id = b.id where x=y
    select * from tab1a, tab2 b where a.id = b.id and x=y
    this is only a syntax difference or there is a performance difference? which one is better for performance?

    The first query (using the join clause) is the ANSI standard way of writing joins and is usually supported by all mainstream RDBMSs.
    The second query is the T-SQL method of writing joins and may have limited re-usability with other RDBMSs.
    In most cases which one you use is usually one of preference, ie, which ever one you're comfortable with.
    From a technical perspective there are some join constructs that you cannot build with T-SQL joins, but can build with ANSI joins (eg, you may have problems in T-SQL with a table that you want to be both a) an inner table of an outer join and b) part of a equi/inner join).
    Soooo, ANSI joins provide you a lot more flexibility in coding as well as portability (between other RDBMSs).  But if you're going to work with ASE you'll still need to understand how T-SQL joins work as you'll see quite a lot of T-SQL join-based queries.

  • How can I pass multiple condition in where clause with the join table?

    Hi:
    I need to collect several inputs at run time, and query the record according to the input.
    How can I pass multiple conditions in where clause with the join table?
    Thanks in advance for any help.
    Regards,
    TD

    If you are using SQL-Plus or Reports you can use lexical parameters like:
    SELECT * FROM emp &condition;
    When you run the query it will ask for value of condition and you can enter what every you want. Here is a really fun query:
    SELECT &columns FROM &tables &condition;
    But if you are using Forms. Then you have to change the condition by SET_BLOCK_PROPERTY.
    Best of luck!

  • DB connectivi​ty toolkit: syntax error in a SELECT data from joined tables

    Hello everyone
    I'm trying to put in labview an SQL query on joined tables.
    As example I take a DB for storing the data of 2on2 basketball games, whose tables are
    matches(matchId,teamA,teamB)
    teams(teamId,PlayerAname,PlayerBname,Nationality)
    nationalities(NatId,natName)
    To get a result table with the match number and the player names along with their nationality I use this query on MySQL (which works on the command line interface)
    SELECT MatchID,
                     t1.PlayerAName, t1.PlayerBName, n1.natName,
                     t2.PlayerAName, t2.PlayerBName, n2.natName
    FROM matches m
    INNER JOIN teams t1 ON t1.teamID = m.teamA
    INNER JOIN teams t2 ON t2.teamID = m.teamB
    INNER JOIN nationalities n1 ON n1.natID = t1.nationality
    INNER JOIN nationalities n2 ON n2.natID = t2.nationality
    When I put it in labview, using the "select data" block, I get a syntax error as shown in the attached screenshot.
    Am I mistanking something in using the JOIN statements, or the aliases?
    Thanks in advance!
    Solved!
    Go to Solution.
    Attachments:
    select2dabone.vi ‏12 KB

    Giovasa wrote:
    I do't like very much the chain of blocks execute query+n*(fetch element)+free object, so I try to avoid that as much that I can...
    Sounds like a prime candidate for a subVI. You don't have to use it every time, but it probably would help for cases where you do want to put the SQL query directly in code.
    Incidentally, if you're doing joins, you might consider using views, as that allows you to hide the details of the interactions of the tables in the DB itself.
    Try to take over the world!

  • How to tune the performance of Oracle SQL/XML query?

    Hi all,
    I am running Oracle 9i and like to run the following Oracle SQL/XML query. It takes about 3+ hour and still not finish. If I get rid all the XML stuffs it only take minutes to run. Does anybody know how to what's the reason of this slow and how to tune it?
    SELECT XMLElement("CUSTOMER",
    XMLForest(C_CUSTKEY "C_CUSTKEY", C_NAME "C_NAME", C_ADDRESS "C_ADDRESS", C_PHONE "C_PHONE", C_MKTSEGMENT "C_MKTSEGMENT", C_COMMENT "C_COMMENT"),
    (SELECT XMLAgg(XMLElement("ORDERS",
    XMLForest(O_ORDERKEY "O_ORDERKEY", O_CUSTKEY "O_CUSTKEY", O_ORDERSTATUS "O_ORDERSTATUS", O_ORDERPRIORITY "O_ORDERPRIORITY", O_CLERK "O_CLERK", O_COMMENT "O_COMMENT"),
    (SELECT XMLAgg(XMLElement("LINEITEM",
    XMLForest(L_ORDERKEY "L_ORDERKEY", L_RETURNFLAG "L_RETURNFLAG", L_LINESTATUS "L_LINESTATUS", L_SHIPINSTRUCT "L_SHIPINSTRUCT", L_SHIPMODE "L_SHIPMODE", L_COMMENT "L_COMMENT")
    FROM LINEITEM
    WHERE LINEITEM.L_ORDERKEY = ORDERS.O_ORDERKEY)
    FROM ORDERS
    WHERE ORDERS.O_CUSTKEY = CUSTOMER.C_CUSTKEY)
    FROM CUSTOMER ;
    Thanks very much in advance for your time,
    Jinghao Liu

    ajallen wrote:
    Why not something more like
    SELECT *
    FROM fact1 l,
    FULL OUTER JOIN fact1 d
    ON l.company = d.company
    AND l.transactiontypeid = 1
    AND d.transactiontypeid = 2;
    Because this is not an equivalent of the original query.
    drop table t1 cascade constraints purge;
    drop table t2 cascade constraints purge;
    create table t1 as select rownum t1_id from dual connect by level <= 5;
    create table t2 as select rownum+2 t2_id from dual connect by level <= 5;
    select * from (select * from t1 where t1_id > 2) t1 full outer join t2 on (t1_id = t2_id);
    select * from t1 full outer join t2 on (t1_id = t2_id and t1_id > 2);
         T1_ID      T2_ID
             3          3
             4          4
             5          5
                        6
                        7
         T1_ID      T2_ID
             1
             2
             3          3
             4          4
             5          5
                        6
                        7

Maybe you are looking for

  • Lightening wire with Bose speaker stopped working

    Lightening wire stopped working with Bose speaker ... bought another one and this one is not working either - i don't recall changing any phone settings to make it stop working - any ideas? Have also tried it on other speaker devices at home, so I th

  • What HTML and JavaScript engine is used within Adobe AIR on the desktop?

    HTML and JavaScript within Adobe AIR are handled by the WebKit HTML/JavaScript engine.

  • Can only play sound as root (Solved)

    I followed these steps: http://wiki.archlinux.org/index.php/ALSA to get my sound working. However, I can only play sound when logged in as root, even though I've added my user to the audio group. I am getting this output: Can't load plugin libffmpeg_

  • How to syncronize data between resource and IdM?

    I created a form (assign to proxy administrator) for reconciliation, and it gets executed when I imported new user into IdM through full reconciliation. In this way I can assign email of user to waveset.email. But later when the email gets updated in

  • Getting Sort parameters(order,columns) from DatabaseFilter.

    Hi all, Could anyone guide me on how to get the Columns that are being selected for sorting and the sorting order itself from the DatabaseFilter. We have our own class which takes in the column names and sort order and generates the SQL(similar to th