SQL: Select DISTINCT only on certain fields?

This is an odd question. Partly because it's late and I'm not
thinking
straight, but...
I have a query consisting of 9 joins. It works fine.
However, I've encountered a bit of an issue with my data that
would much
easier to fix via a query than actually fixing the data (as
the data fix
would require committee approvals and the like...)
In a nutshell, my query is trying to return a DISTINCT set of
recrods.
The catch is that my records are ALMOST distrinct, except for
one field. Is
there a way to use the distinct command in a way the excludes
specific
fields?
-Darrel

> No; DISTINCT applies to all columns returned by your
SELECT statement.
> You didn't provide a lot of information, but typically,
if you need
> DISTINCT, then you've done something wrong.
It's a complex join. The data is this:
Packet table (record of a packet of forms)
which point to...
Packet variations (each packet can have a variation)
which point to...
Forms table (record of a form)
which points to...
Form variations (individual forms)
The catch is that multiple Packet Variations can point to the
same Forms, so
when I query the database to get all variations of a packet
and related
forms, I can end up with duplicate records of forms.
This isn't a big deal, as DISTINCT can work for this. The
catch is that we
also let each Packet Variations' forms be sorted
individually. It's this
'sort' field that ends up causing the Distinct not to work,
as the sort
might be completely unique for each one.
ALL THAT SAID, this is definitely more of a policy issue than
a technology
issue. However, getting them to change policy is sometimes
more work than
finding a technology workaround.
I could just query the DB and return all the duplicates and
then sort things
out in the code, but I was hoping that maybe there was a
clever way to
handle this via SQL.
> Giving you the benefit of the doubt, if you need some of
your returned
> columns to be unique in the result set, but not all of
them, then you need
> to use GROUP BY. You'll need to decide how you want SQL
Server to
> determine which value to use for columns that are not
part of the unique
> group.
Ah, I'll look into that! Thanks, lionstone!
-Darrel

Similar Messages

  • SELECT DISTINCT only on some fields but returning other fields.

    As the thread says I need to select distinct rows with some fields but I need to show the associated data of other columns in the same table.
    Simple Example
    SUPPOSE THE TABLE INFO:
    INFO(ID, NAME, TITLE, NUMBER, TELEPHONE, FAX, DESCRIPTION, TOPIC);
    The table info could have null values in all the columns except for the ID. And there could be the same information for: Name, Title, Number, Telephone, Fax info in a lot of rows.
    With the following statement I get distinct rows based on the name, title, number, telephone, fax and i get assured that the row with name in null is not returned.
    SELECT DISTINCT P.NAME, P.TITLE,P.NUMBER,P.TELEPHONE,P.FAX FROM INFO P WHERE TRIM(P.NAME) IS NOT NULL;
    returns 1400 rows;
    The problem is that I need the DESCRIPTION and TOPIC columns of the 1400 distinct rows.
    I have tried the following, but without sucess because the statement is returning 1350 rows, so there are 50 rows losted:
    SELECT P.NAME, P.TITLE,P.NUMBER,P.TELEPHONE,P.FAX, P.DESCRIPTION,P.TOPIC
    FROM INFO P , (SELECT DISTINCT P.NAME, P.TITLE,P.NUMBER,P.TELEPHONE,P.FAX FROM INFO P WHERE TRIM(P.NAME) IS NOT NULL) R
    WHERE P.NAME= R.NAME AND P.TITLE = R.TITLE AND P.NUMBER = R.NUMBER AND P.TELEPHONE = R.TELEPHONE AND P.FAX = R.FAX;
    Could anybody give me some help?
    pd: Don´t ask why the table has been designed in that way... I'm trying to fix that ¬¬
    Edited by: user6483610 on Sep 1, 2010 6:29 PM

    @Raj Mareddi: I have tried that aproach and it gives the ORA-00979: not a GROUP BY expression
    @PhoenixBai: You put me to think... jajaja i haven't think about it, actually there are more distinct values if I put the DESCRIPTION and TOPIC values in the query and yes I was hoping that the query choose for me... So I think that theres no way, the quality of the data is really bad and I have to deal with it. Thanks anyway!
    By oher hand theres no way to do this thing in Oracle? the aproach of Raj makes sense but the ORA-00979: not a GROUP BY expression says that you must remove the other columns that are not in the group by function.

  • Only show certain fields after a date has passed

    How would I set a recordset to only show certain fields after
    a date has
    passed?
    For example:
    I have a list of classified adverts some which include an
    image which the
    client pays extra for. After a certain time period, say, 1
    year,
    would it be possible to use some kind of IF statement (or
    something) to no
    longer show the image?
    Thanks
    Gary

    scrap that entire post man.
    I'll rewrite it here in a few.
    "crash" <[email protected]> wrote in message
    news:[email protected]...
    >
    OK. I can't be as much help as I was hoping, since I
    just did this in
    > PHP and MySQL. But we can do a bit. My ASP is rusty
    enough I'm just going
    > to give you what I think you should do.
    >
    > You'll need to research how to format dates and most
    importantly strip
    > away the timestamp. In MySQL, you can format the date as
    it comes out of
    > the recordset. I'm not sure if you can do this in
    access, but I would
    > imagine that you can (indeed, it might be the same SQL).
    >
    > <%
    > varToday = Date (should be able to format out timesteamp
    here);
    > varTerm = 365; 'This will be your constant term, defined
    in days, it looks
    > like from archived posts
    >
    > varExpiredDate = varToday = varTerm;
    >
    > Search your recordset via varTerm. ie
    > WHERE datefield < <% varTerm %>
    >
    > You will need to search date formatting in Access to see
    how to strip out
    > the Timestamp from your date, but you should be able to
    do this from your
    > SQL statement, and return just the date, this will be
    compared to your
    > varTerm, which basically states that if your signup date
    is beyond a year
    > from today, your ad will need to be renewed.
    >
    > I"m not very happy with this, but it's all my brain is
    coming up with
    > right now. Gimme a few to review it and I might have
    something more for
    > you.
    >
    > HTH, sorry I couldn't give you code or urls for date
    formatting.
    >
    > Additionally, you will eventually need to build
    somethign that checks
    > images and and dates and then sends an email to your
    customer letting them
    > know their term has expired.
    >
    > OR - You could also add a new field to your database
    which automatically
    > updates an "expire" time in your ad table which
    automatically adds days to
    > the time. If you do this, you don't have to worry about
    stripping
    > timestamps or anyting, and you can just do a simple
    lookup for if Date >=
    > DateExpireField then don't pull image.
    >
    >
    >

  • Pl/sql select distinct in a where clause

    Greedings,
    I am trying to execute some kind of distinct using rowid in where clause but for some reason im not getting the appropriate result. Any guidance is welcome
    SELECT acnt_code,cat,cat_desc,buc FROM so_budgets_cat where
    Trim(buc)='S03'
    and
    NOT exists (SELECT  1
                       from   so_budgets_cat tab2
                       where  (  tab2.cat     =  so_budgets_cat.cat )
                       and    tab2.ROWID  > so_budgets_cat.ROWID
    ORDER BY cat,so_budgets_cat.rowidThanks in advance

    Can you provide some example data and example output to further clarify?
    It might be that you want something like the code below, but it's hard to tell.
    SELECT acnt_code
    ,      cat
    ,      cat_desc
    ,      buc
    FROM
    (SELECT acnt_code
    ,      cat
    ,      cat_desc
    ,      buc
    ,      ROW_NUMBER() OVER (PARTITION BY cat ORDER BY <something>) rn
    FROM   so_budgets_cat
    WHERE  Trim(buc)='S03')
    WHERE rn = 1;

  • Query that only returns certain fields in Java

    Currently I'm using a filter that identifies some keys, I then get all the keys and get a single value from each object. The rest of the object is quite large. I've seen references in passing on the ability to do this, using CohQL but I can't get it to work from Java.
    Basically, I want to do: "Select field from "Cache" where key='asdf'". I just want to get back the specific "field" rather than the whole object. How do I do this?
    Thanks.

    Hi,
    It should be easy if your object has a getField() accessor. Hope this helps ...
    http://download.oracle.com/docs/cd/E15357_01/coh.360/e15723/api_cq.htm#CEGDIJEC
    Using Path-Expressions
    One of the main building blocks of CohQL are path-expressions. Path expressions are used to navigate through a graph of object instances. An identifier in a path expression is used to represent a property in the Java Bean sense. It is backed by a ReflectionExtractor that is created by prepending a get and capitalizing the first letter. Elements are separated by the "dot" (.) character, that represents object traversal. For example the following path expression is used to navigate an object structure:
    a.b.c
    It reflectively invokes these methods:
    getA().getB().getC()
    For example ...
    Select the home state and age of employees in the cache ContactInfoCache, and group by state and age.
    select homeAddress.state, age, count() from "ContactInfoCache" group by homeAddress.state, age

  • Equivalent of select distinct

    Hi all,
    I have a dataset brought into my Flex app by a server-side database call as XML. I then need to use this same dataset in a couple of different places, eg in a grid, as chart data, in a combo etc. So far no problem.
    Now, for the combo entries what I would like to do is the equivalent of SQL "select distinct field_name from table_name", but applied directly to the XML I have brought back already. Is there such a beast in the XML-handling methods? I have found a work-around which sets up an Array, then cycles round the XML nodes and either adds the relevant field value as the next entry or skips it accordingly. But this seems unduly manual and (I suspect) will not be very snappy as the data set grows. Just now I am working with a fairly small test set but that will change.
    Any suggestions?
    Thanks in advance,
    Richard

    You're welcome I think that so far there isn't a method like that 
    probably an enhance request. In that case you'll need to traverse the 
    XML and add the items to another XMLList or an AC.
    Sincerely,
    Michael
    El 27/04/2009, a las 8:51, Richard_Abbott <[email protected]> escribió:
    >
    Thanks Michael and Barna, but this doesn't really address the 
    problem. The data is well structured and I am using E4X methods. But 
    the examples don't (I think) meet the need. Take the trilemetry 
    example. In the XML file we have two individuals named "John". The 
    requirement is to come up with a reduced list of unique elements so 
    including Bob, John, Jane, Art, Brad... ie John only the once as we 
    already have that name in. Clearly in this case not much of a 
    reduction but where I am generating a selection box where the 
    categorisation is much more common it is essential. Take Fisher's 
    Iris data - you have 150 rows consisting of 50 each of three kinds 
    of iris. Obviously in the drop-down selector you just want 3 names 
    not 150. I think it would be much neater if I could just pull them 
    out with an E4X-style query, but so far I haven't found a method for 
    this, hence the work-around of manually looping and testing.
    Richard
    >

  • SQL SELECT DROPPING LEADING ZEROS

    Has anyone run accross the problem of Oracle 10g dropping the leading zeros on a Varchar field when you select the value?? Do you know the fix?

    SQL> desc pa_Students;
    Name Null? Type
    ID NOT NULL NUMBER(22)
    SQL> select distinct id from pa_students;
    ID
    2841
    2843
    2846
    2861
    2867
    2873
    2890
    2892
    2903
    9 rows selected.
    SQL> select distinct to_char(id,'000000000') from pa_students;
    TO_CHAR(ID,'000000000')
    000002841
    000002843
    000002846
    000002861
    000002867
    000002873
    000002890
    000002892
    000002903
    9 rows selected.
    SQL> select distinct lpad(id,9,'0') from pa_students;
    LPAD(ID,9,'0')
    000002841
    000002843
    000002846
    000002861
    000002867
    000002873
    000002890
    000002892
    000002903
    9 rows selected.
    The problem is that I need to first have the leading zeros. I also need to select multiple fields, but
    because of all of the extra spaces to the right of the data, everything I pick gets wrapped around. This
    never happened until we moved to an Oracle 10g database.

  • SELECT DISTINCT with JOIN

    Hi,
    how Do I write this select in rigth way in ABAP
    SELECT ska1ktopl AS ktopl ska1saknr AS saknr
        t370k_t~eartx AS eartx
        INTO  TABLE lt_ska1 FROM ska1
        JOIN (SELECT DISTINCT damage_gl FROM  zzpm_cost_elem )  ON ska1saknr = zzpm_cost_elemdamage_gl.
    The problem with the select "SELECT DISTINCT damage_gl FROM  zzpm_cost_elem " which I have to put table name instead of it
    What should I do ?
    Thx

    Hi Friend ,
    Please see this example  how you can use the select DISTINCT statement
    DATA: ITAB TYPE STANDARD TABLE OF SPFLI,
          WA LIKE LINE OF ITAB.
    DATA: LINE(72) TYPE C,
          LIST LIKE TABLE OF LINE(72).
    LINE = ' CITYFROM CITYTO '.
    APPEND LINE TO LIST.
    SELECT DISTINCT (LIST)
           INTO CORRESPONDING FIELDS OF TABLE ITAB
           FROM SPFLI.
    IF SY-SUBRC EQ 0.
      LOOP AT ITAB INTO WA.
        WRITE: / WA-CITYFROM, WA-CITYTO.
      ENDLOOP.
    ENDIF.
    Regards,

  • Select distinct records without using distinct

    hi experts,
    my retrieved data like these:
    cnt_id cnt_type rcrd_id wrkflw_id
    558848     PRODUCT     553503     248     
    558848     PRODUCT     553503     248     
    558848     PRODUCT     553503     248     
    558808     PRODUCT     553463     248     
    558808     PRODUCT     553463     248     
    558808     PRODUCT     553463     248     
    558810     PRODUCT     553463     248     
    558810     PRODUCT     553463     248     
    558810     PRODUCT     553463     248
    now i want to select one record for each cnt_id without using any distinct function .. how can i do that?
    regards,
    SKP

    you can use the below query
    select * from t where rowid in (select max(rowid)
    from t group by cnt_id)You're query is not the equivalent of DISTINCT.
    SQL> ed
    Wrote file afiedt.buf
      1  create table t as
      2            (select 558848 as cnt_id, 'PRODUCT' as cnt_type, 553503 as rcrd_id, 248 as wrkflw_id from dual union all
      3             select 558848, 'RETURN', 553503, 248 from dual union all
      4             select 558848, 'PRODUCT', 553503, 248 from dual union all
      5             select 558808, 'PRODUCT', 553463, 248 from dual union all
      6             select 558808, 'PRODUCT', 553463, 248 from dual union all
      7             select 558808, 'PRODUCT', 553463, 248 from dual union all
      8             select 558810, 'PRODUCT', 553463, 248 from dual union all
      9             select 558810, 'PRODUCT', 553463, 248 from dual union all
    10*            select 558810, 'PRODUCT', 553463, 248 from dual)
    11  /
    Table created.
    Elapsed: 00:00:00.01
    SQL> select * from t where rowid in (select max(rowid) from t group by cnt_id);
        CNT_ID CNT_TYP    RCRD_ID  WRKFLW_ID
        558810 PRODUCT     553463        248
        558808 PRODUCT     553463        248
        558848 PRODUCT     553503        248
    Elapsed: 00:00:00.00
    SQL> select distinct * from t;
        CNT_ID CNT_TYP    RCRD_ID  WRKFLW_ID
        558810 PRODUCT     553463        248
        558808 PRODUCT     553463        248
        558848 RETURN      553503        248
        558848 PRODUCT     553503        248
    Elapsed: 00:00:00.00
    SQL>

  • Changing value of select list to match report field

    I have an Apex page that has a report region and a form region.
    The report region returns a single row of data from a SQL select. One of the fields returned is a user id (which I translate into a user name using a LOV).
    In the form region, I have a select list containing users (based on the same LOV as above). The form is used to add a new record to a table. I want the select list in the form region to display the same user as displayed in the reports region. I'm adding in the form is based on the user id in the report region.
    How do I do this? Because the form region is adding a new record, and uses the Database field as Source, it always displays the first item in the LOV.
    I tried using computations to override what's in the select list in the form region (by doing a SQL select and getting the same row of data as in the reports region) but this doesn't seem to work. The select list just always defaults to the first user.
    Is there a trick for making one select list match another?

    Cheers - think you're right, using the default will do it. Having a bit of trouble with my SQL select now though...
    This is the SQL I'm was using
    SELECT ASSIGNED_USER_ID FROM REQUEST WHERE REQUEST_ID = 1;
    How do I rewrite this as a PL/SQL function or expression to return the ASSIGNED_USER_ID field as my default (I'm still learning the basics of PL/SQL)?

  • Disabling certain fields on the selection screen.

    Hi all,
              I want to disable certain fields on selection screen of my program, also i want to display certain fields on selection screen only if a particular field on the selection screen is checked or selected. Please guide me how this can be achieved via coding in a program.
    Thanks & regards,
    Chetan.

    Hi Chetan,
    try this.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS: pa_file TYPE rlgrap-filename MODIF ID abc,
    pa_lifnr TYPE lfa1-lifnr MODIF ID abc,
    pa_vkorg TYPE vbak-vkorg MODIF ID abc.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    PARAMETERS: pa_kunnr TYPE vbak-kunnr MODIF ID def.
    SELECT-OPTIONS: s_lifnr FOR gs_lfa1-lifnr MODIF ID def,
    s_date FOR gs_lfa1-erdat MODIF ID def,
    s_augru FOR gs_vbak-augru MODIF ID def,
    s_vbeln FOR gs_vbak-vbeln MODIF ID def.
    SELECTION-SCREEN END OF BLOCK b2.
    SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: pa_upd RADIOBUTTON GROUP g1 USER-COMMAND uc01 DEFAULT 'X'."#EC *
    SELECTION-SCREEN COMMENT 3(60) text-004 FOR FIELD pa_upd.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: pa_rep RADIOBUTTON GROUP g1 ."#EC *
    SELECTION-SCREEN COMMENT 3(60) text-005 FOR FIELD pa_rep.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK b3.
    IF pa_rep EQ gc_x.
    LOOP AT SCREEN.
    IF screen-group1 = gc_abc.
    screen-input = gc_zero_num.
    ELSEIF screen-group1 = gc_def.
    screen-active = gc_one_num.
    ENDIF.
    MODIFY SCREEN.
    ENDLOOP.
    ELSEIF pa_upd EQ gc_x.
    *For Reprocessing
    LOOP AT SCREEN.
    IF screen-group1 = gc_def.
    screen-input = gc_zero_num.
    ELSEIF screen-group1 = gc_abc.
    screen-active = gc_one_num.
    ENDIF.
    MODIFY SCREEN.
    CLEAR pa_upd.
    ENDLOOP.
    ENDIF.
    REPORT zrich_001.
    PARAMETERS: p_rad1 RADIOBUTTON GROUP grp1 DEFAULT 'X'
    user-command chk,
    p_rad2 RADIOBUTTON GROUP grp1.
    SELECT-OPTIONS: s_datum1 FOR sy-datum MODIF ID d1,
    s_datum2 FOR sy-datum MODIF ID d2.
    AT SELECTION-SCREEN OUTPUT.
    LOOP AT SCREEN.
    IF p_rad1 = 'X'
    AND screen-group1 = 'D2'.
    screen-active = '0'.
    ENDIF.
    IF p_rad2 = 'X'
    AND screen-group1 = 'D1'.
    screen-active = '0'.
    ENDIF.
    MODIFY SCREEN.
    ENDLOOP.
    reward if useful.
    regards,
    sravanthi.

  • Is there a way to create forms where certain fields would become required only if there was a certain choice made in a dropdown box in another field?

    Is there a way to create forms where certain fields would become required only if there was a certain choice made in a dropdown box in another field?

    Yes but you will have to create some custom JavaScript to do this.
    Also you should be aware that the "Required" property is only processed when the form is submitted to a scripted web page or "mailto:" process.

  • Need help for SQL SELECT query to fetch XML records from Oracle tables having CLOB field

    Hello,
    I have a scenario wherein i need to fetch records from several oracle tables having CLOB fields(which is holding XML) and then merge them logically to form a hierarchy XML. All these tables are related with PK-FK relationship. This XML hierarchy is having 'OP' as top-most root node and ‘DE’ as it’s bottom-most node with One-To-Many relationship. Hence, Each OP can have multiple GM, Each GM can have multiple DM and so on.
    Table structures are mentioned below:
    OP:
    Name                             Null                    Type        
    OP_NBR                    NOT NULL      NUMBER(4)    (Primary Key)
    OP_DESC                                        VARCHAR2(50)
    OP_PAYLOD_XML                           CLOB       
    GM:
    Name                          Null                   Type        
    GM_NBR                  NOT NULL       NUMBER(4)    (Primary Key)
    GM_DESC                                       VARCHAR2(40)
    OP_NBR               NOT NULL          NUMBER(4)    (Foreign Key)
    GM_PAYLOD_XML                          CLOB   
    DM:
    Name                          Null                    Type        
    DM_NBR                  NOT NULL         NUMBER(4)    (Primary Key)
    DM_DESC                                         VARCHAR2(40)
    GM_NBR                  NOT NULL         NUMBER(4)    (Foreign Key)
    DM_PAYLOD_XML                            CLOB       
    DE:
    Name                          Null                    Type        
    DE_NBR                     NOT NULL           NUMBER(4)    (Primary Key)
    DE_DESC                   NOT NULL           VARCHAR2(40)
    DM_NBR                    NOT NULL           NUMBER(4)    (Foreign Key)
    DE_PAYLOD_XML                                CLOB    
    +++++++++++++++++++++++++++++++++++++++++++++++++++++
    SELECT
    j.op_nbr||'||'||j.op_desc||'||'||j.op_paylod_xml AS op_paylod_xml,
    i.gm_nbr||'||'||i.gm_desc||'||'||i.gm_paylod_xml AS gm_paylod_xml,
    h.dm_nbr||'||'||h.dm_desc||'||'||h.dm_paylod_xml AS dm_paylod_xml,
    g.de_nbr||'||'||g.de_desc||'||'||g.de_paylod_xml AS de_paylod_xml,
    FROM
    DE g, DM h, GM i, OP j
    WHERE
    h.dm_nbr = g.dm_nbr(+) and
    i.gm_nbr = h.gm_nbr(+) and
    j.op_nbr = i.op_nbr(+)
    +++++++++++++++++++++++++++++++++++++++++++++++++++++
    I am using above SQL select statement for fetching the XML records and this gives me all related xmls for each entity in a single record(OP, GM, DM. DE). Output of this SQL query is as below:
    Current O/P:
    <resultSet>
         <Record1>
              <OP_PAYLOD_XML1>
              <GM_PAYLOD_XML1>
              <DM_PAYLOD_XML1>
              <DE_PAYLOD_XML1>
         </Record1>
         <Record2>
              <OP_PAYLOD_XML2>
              <GM_PAYLOD_XML2>
              <DM_PAYLOD_XML2>
              <DE_PAYLOD_XML2>
         </Record2>
         <RecordN>
              <OP_PAYLOD_XMLN>
              <GM_PAYLOD_XMLN>
              <DM_PAYLOD_XMLN>
              <DE_PAYLOD_XMLN>
         </RecordN>
    </resultSet>
    Now i want to change my SQL query so that i get following output structure:
    <resultSet>
         <Record>
              <OP_PAYLOD_XML1>
              <GM_PAYLOD_XML1>
              <GM_PAYLOD_XML2> .......
              <GM_PAYLOD_XMLN>
              <DM_PAYLOD_XML1>
              <DM_PAYLOD_XML2> .......
              <DM_PAYLOD_XMLN>
              <DE_PAYLOD_XML1>
              <DE_PAYLOD_XML2> .......
              <DE_PAYLOD_XMLN>
         </Record>
         <Record>
              <OP_PAYLOD_XML2>
              <GM_PAYLOD_XML1'>
              <GM_PAYLOD_XML2'> .......
              <GM_PAYLOD_XMLN'>
              <DM_PAYLOD_XML1'>
              <DM_PAYLOD_XML2'> .......
              <DM_PAYLOD_XMLN'>
              <DE_PAYLOD_XML1'>
              <DE_PAYLOD_XML2'> .......
              <DE_PAYLOD_XMLN'>
         </Record>
    <resultSet>
    Appreciate your help in this regard!

    Hi,
    A few questions :
    How's your first query supposed to give you an XML output like you show ?
    Is there something you're not telling us?
    What's the content of, for example, <OP_PAYLOD_XML1> ?
    I don't think it's a good idea to embed the node level in the tag name, it would make much sense to expose that as an attribute.
    What's the db version BTW?

  • How to restrict AS02 access to certain fields only

    How to restrict AS02 (Asset Master Record) access to certain fields only. Currently when you assigned AS02 to a certain user, this will enable the user to change all the fields in the asset master record. Suppose i want only the user to restrict the access to certain field eg.NDJAR (Life in Yrs).
    Thanks for your inputs.
    Regards,
    Robert

    hello,
    basis has to assign the proper activity with object A_S_ANLKL. in this case they have to allow activity 03 only with combination of Cocode,asset class. see some more details below.
    This authorization object is the first part of the object "asset master record."
    The definition at this level determines whether the user is authorized to process data in a given company code. The activity type for the transaction is also defined here. This authorization object is used for master data transactions, for the display of value fields, and for reporting.
    Defined Fields
    The following fields are assigned to the authorization object
    Asset class (specified by entering a value in the pop-up window)
    Company code (specified by entering a value in the pop-up window)
    Activity type - there are three different activity types:
    01 = Create
    02 = Change (including blocking and deleting)
    03 = Display

  • Need of SQL query in selecting distinct values from two tables

    hi,
    I need a query for selecting distinct values from two tables with one condition.
    for eg:
    there are two tables a & b.
    in table a there are values like age,sex,name,empno and in table b valuses are such as age,salary,DOJ,empno.
    here what i need is with the help of empno as unique field,i need to select distinct values from two tables (ie) except age.
    can anybody please help me.
    Thanks in advance,
    Ratheesh

    Not sure what you mean either, but perhaps this will start a dialog:
    SELECT DISTINCT a.empno,
                    a.name,
                    a.sex,
                    b.salary,
                    b.doj
    FROM    a,
            b
    WHERE   a.empno = b.empno;Greg

Maybe you are looking for