How to select 2 columns condition?

Hi all,
I have 2 columns list that I want to select in my where condition.
SELECT EMP_ID,EMP_NAME FROM EMP WHERE (EMP_ID,EMP_NAME) IN
(100,'SCOTT'
200,'STEVE'
300,'LARRY');
Something like it....how do i write the right code please....
Thanks a lot.

You welcome dear.. :)
You know what, by helping you I reached one level ahead in my favourite community... ( I know for many it doesn't matter much , but for me it means a lot)
It feels great and satisfied to help others in getting the direction towards the answer of their confusions/questions with the knowldege you got..
The expert friends of this community helped me many times to clarify my concepts and fundamentals of oracle, And so I had decided to always spare some time here to help others too..
I will keep learning new things and keep sharing it here... Great being the member of this comm..
Regards..

Similar Messages

  • How to select columns in a table by their column id and not the column name

    Hello,
    How do you select columns from a table based on their column_id.
    I have create a view
    but other than Select * , i cant now select one just one column from it
    the view as follow:
    create view count_student as
    select a.acode "acode",aname "Activity Name",count(ae.acode) "Number of student joined"
    from aenrol ae, activity a
    where a.acode= ae.acode
    group by a.acode,aname;

    The issue is that you have decided to use quoted column names. A pretty horrible idea (mostly for the reasons that you are now finding).
    Re-create the view and get rid of the silly double quotes.

  • How to select columns with CustomTableCellRenderer

    Hello,
    i made a JTable and I set some methods
    tabel.setRowSelectionAllowed(false);
    tabel.setColumnSelectionAllowed(true);
    When i want to use the DefaultTableCellRenderer, there are no problems
    to select the column like I set ...
    But if I use my own CustomTableCellRenderer to change the color and the
    tooltiptext of a cell, he doesn't want to select my column ...
    What's my mistake ? Did I forget something to add in my CustomCellRenderer ?
    grtz
    Kristof

    Your selection is still there, just that you can't see it. Take a look at the code in the JDK source for DefaultTableCellRenderer to see how it uses the selected status of the cell to paint the cell appropriately.

  • How to select columns from internal table using 'GUI_DOWNLOAD' ?

    Hi,
    i am running a report & the fields for output is saved in an internal table which has as many as 10 fields. But I want to select only a few fields for output. There is a option COL_SELECT in function 'GUI_DOWNLOAD'. How to use it. If possible with example.

    Hai VijayKumar
    Try with the following code
    tables : mara.
    data : begin of it_mara occurs 0,
           matnr like mara-matnr,
           mbrsh like mara-mbrsh,
           mtart like mara-mtart,
           meins like mara-meins,
           end of it_mara.
    parameters : P_mtart like mara-mtart default 'ROH'.
    start-of-selection.
    perform select_data.
    perform download_data.
    *&      Form  select_data
          text
    -->  p1        text
    <--  p2        text
    FORM select_data .
    select
          matnr
          mbrsh
          mtart
          meins
          from mara into table it_mara
          where mtart = p_mtart.
    ENDFORM.                    " select_data
    *&      Form  download_data
          text
    -->  p1        text
    <--  p2        text
    FORM download_data .
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        FILENAME                        = 'c:\down.txt'
        FILETYPE                        = 'ASC'
        COL_SELECT                      = 'X'
        COL_SELECT_MASK                 = 'X XX'
      TABLES
        DATA_TAB                        = it_mara.
      IF SY-SUBRC = 0.
        SORT IT_MARA BY MATNR.
      ENDIF.
    ENDFORM.                    " download_data
    Thanks & Regards
    Sreenivasulu P

  • How to select column dynamically with sharepoint list as data source in ssrs report

    Hi all,
    I am creating reports from SharePoint list but i have requirements to select the column name dynamically with SharePoint list as data source. I didn't find any way of doing this.. 
    Can anyone help me to resolve this issue..
    There is no way of specifying column name dynamically here in data set query
    <RSSharePointList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <ListName>test list</ListName>
      <ViewFields>
        <FieldRef Name="ID" />
        <FieldRef Name="ContentType" />
        <FieldRef Name="Title" />
        <FieldRef Name="Modified" />
        <FieldRef Name="Created" />
        <FieldRef Name="Author" />
        <FieldRef Name="Editor" />
        <FieldRef Name="_UIVersionString" />
        <FieldRef Name="Attachments" />
        <FieldRef Name="Edit" />
        <FieldRef Name="LinkTitleNoMenu" />
        <FieldRef Name="LinkTitle" />
        <FieldRef Name="DocIcon" />
        <FieldRef Name="ItemChildCount" />
        <FieldRef Name="FolderChildCount" />
        <FieldRef Name="test_x0020_date" />
        <FieldRef Name="title2" />
      </ViewFields>
    </RSSharePointList>

    Hi MNRSPDev,
    Sorry for the delay.
    According to the current description, I understand that you want to specify column name in dataset query designer dynamically when using SharePoint list data source.
    Based on my research, this is not supported by default. As a workaround, you can use XML data source. The XML content can be embedded directly within the query. This lets you use the expression capabilities within the processing engine to build queries and
    data dynamically within the report. And it can be used for retrieving XML data directly from an external data source, passing it using parameters, and embedding it within the query.
    Reference:
    http://www.codeproject.com/Articles/56817/Dynamic-Reports-with-Reporting-Services
    Hope this helps.
    Regards,
    Heidi Duan
    Heidi Duan
    TechNet Community Support

  • How to select column used in parameter in sql

    Hi,
    I have one View in which I am calling Function,
    Below is the part of that Function. I am passing @Column_Name as parameter. I have total 3 Columns which I am using in my view form this function.
    Now I have one issue in this SQL Query, instead of taking values from 'Alle' (or 'MeAlle', 'CurrentMe')column, my select statement is taking 'Alle' as value. I tried with Dynamic SQL but didn't work out for me.
    Please help me on this below Query. Thanks in advance. 
    DECLARE @Column_Name varchar(max)
    SET @Column_Name = 'Alle' -- Alle, MeAlle, CurrentMe
    DECLARE @TempAlleMes TABLE 
    ( PId int NOT NULL,
      Id nvarchar(max) NULL,
      Name nvarchar(max) NULL
    INSERT INTO @TempAlleMes(PId,Id,Name)
    SELECT p.PId,  
    NullIf(SubString(',' + @Column_Name + ',' , t.ID , CharIndex(',' , ',' + @Column_Name + ',' , t.ID) - t.ID) , '') , ''  
    FROM dbo.[Tally] t,[P_PsVs].dbo.[PInfo] p
    WHERE t.ID <= Len(',' + @Column_Name + ',')
    AND SubString(',' + @Column_Name + ',' , t.ID - 1, 1) = ','  
    AND CharIndex(',' , ',' + @Column_Name + ',' , t.ID) - t.ID > 0 
    and p.Pid = 302074
    select * from @TempAlleMes
    Vicky

    This is a terrible table design.
    Anyway, assuming you need to work with such design, you need to create fnSplit function in your database first. You can get any kind of implementation for such function, say, there is a blog by Jeff Moden that still has lots of discussion (I subscribed to
    that discussion and get emails - too bad they only say there is a new reply instead of giving the reply):
    http://www.sqlservercentral.com/articles/Tally+Table/72993/
    So, once you have that splitting function in your database you can normalize your table using the following:
    select T.*, F.Value, F.Id from myTable T CROSS APPLY dbo.fnSplit(T.Alle, ',') F
    If you need to split several columns, then it will be a bit more complex as you would need to split each individual column separately using the above code and cte and then use the FULL JOIN based on main table PK and function's ID column to join the results.
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

  • How to select columns with null values

    HI
    In my table ‘A’ I have 10 columns and 30,000 records. I need all those columns whose value is null for all the records.
    For example in the below table column 'suffix' is null for all the records. So I want column suffix to be selected.
    Name Suffix Street
    James 1100 Washington street
    Richard 273 GEORGIA ST
    Arnold 3018 OAKHILL AVE
    MICHAEL 834 E 161ST ST
    Joseph 410 PINE AVE
    Thanks in advance

    True...
    But, i think here null needs to handle otherwise it will again throw some error like this ->
    satyaki>
    satyaki>select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
    PL/SQL Release 10.2.0.3.0 - Production
    CORE    10.2.0.3.0      Production
    TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production
    Elapsed: 00:00:00.20
    satyaki>
    satyaki>
    satyaki>
    satyaki>SELECT owner, table_name, column_name
      2    FROM all_tab_cols
      3   WHERE data_type NOT IN ('BLOB', 'LONG', 'CLOB')
      4         AND dbms_xmlgen.getxmltype('select count('
      5                                    || CASE
      6                                          WHEN data_type NOT IN
      7                                                     ('BLOB', 'LONG', 'CLOB')
      8                                          THEN
      9                                             column_name
    10                                          ELSE
    11                                             '1'
    12                                       END
    13                                    || ') c from '
    14                                    || owner
    15                                    || '.'
    16                                    || table_name).EXTRACT (
    17               '//text()'
    18            ).getnumberval () = 0
    19         AND table_name IN
    20                  (SELECT table_name
    21                     FROM all_tab_privs
    22                    WHERE privilege = 'SELECT' AND USER IN (grantor, grantee));
    ERROR:
    ORA-19202: Error occurred in XML processing
    ORA-24347: Warning of a NULL column in an aggregate function
    ORA-06512: at "SYS.DBMS_XMLGEN", line 288
    ORA-06512: at line 1
    no rows selected
    Elapsed: 00:00:04.03
    satyaki>Or,
    satyaki>
    satyaki>
    satyaki>SELECT table_name, column_name
      2    FROM user_tab_cols
      3   WHERE data_type NOT IN ('BLOB', 'LONG', 'CLOB')
      4   AND   dbms_xmlgen.getxmltype('select count('
      5                               || CASE
      6                                    WHEN data_type NOT IN ('BLOB', 'LONG', 'CLOB') THEN
      7                                          column_name
      8                                    ELSE
      9                                      '1'
    10                                  END
    11                               || ') c from '||table_name).EXTRACT('//text()').getnumberval() = 0;
    AND   dbms_xmlgen.getxmltype('select count('
    ERROR at line 4:
    ORA-19202: Error occurred in XML processing
    ORA-24347: Warning of a NULL column in an aggregate function
    ORA-06512: at "SYS.DBMS_XMLGEN", line 288
    ORA-06512: at line 1
    Elapsed: 00:00:02.66
    satyaki>
    satyaki>Do you have any idea to resolve this issue in this context?
    Regards.
    Satyaki De.

  • How can i define a boolean variable with the condition if i got a specific text on a selected column?

    How can i define a boolean variable with the condition if i got a specific text on a selected column?
    Example:
    my select results:
    [id = 102] [Company = 'Microsoft']
    If i got microsoft in 'Company' i want to my another table with the columnName "Microsoft" get "true".
    Can you help me?

    That is called 2-table UPDATE.
    Example:
    http://www.sqlusa.com/bestpractices2005/updatewithcorrelatedsubquery/
    Kalman Toth Database & OLAP Architect
    Free T-SQL Scripts
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • How to select different database columns in a single BO Universe Object

    We have 'n' databases. All the databases have identical tables and views but some tables in few database have custom columns.
    Ex. 'database1' has table 'sites' with the following columns
    1. sitenumber
    2. sitename
    3. siteaddress
    4. phone
    5. email
    6. ActivatedDate
    'database2' has table 'sites' with the following columns
    1. sitenumber
    2. sitename
    3. siteaddress
    4. phone
    5. email
    6. ActivatedDate
    7. LocalActivatedDate
    The condition says that
    "Local Activated date will be used if populated in the system otherwise Activated Date will be used"
    How do i create a condition at the universe level which checks whether the column "LocalActivatedDate" is present in the database or not. Also, how to give a condition which select between "ActivatedDate" and "LocalActivatedDate"
    A single universe needs to be created for all the databases. Only the Default Database in connection parameter changes during deployment.
    Can this be achieved using BO Universe Designer only?
    Thanks in Advance,
    Arun
    Edited by: arunkumars on Dec 2, 2009 10:00 AM

    Create a universe with your default connection and then while changing the universe connection you can write an SDK script using universe designer sdk  do a REFRESH STRUCTURE so that all the you will get the schema same as current DB and then you can add predefined condition or object to this universe  (before doing this keep a copy of the universe) .
    You have to do a lot of stuff to keep your universe proper and stable to work with all the databases using designer SDK.
    Can achieve this but with an overhead of writing and calling SDK scripts again and again . ...
    Hope this helps...
    Regards
    Kunal

  • How to insert select columns from one internal table to another

    Hi,
    How to insert select columns from one internal table to another based on condition as we do from a standart table to internal table.
    regards,
    Sriram

    Hi,
    If your question is for copying data from 1 int table to other ;
    we can use
    APPEND LINES OF it_1 TO it_2.
    or if they have different columns then:
    loop at it_1 into wa_it1.
    move wa_it1-data to wa_it2-d1.
    apped wa_it2 to it_2.
    clear wa_it2.
    endloop.
    thnxz

  • How to create a template for more than four column conditions?

    Hi
    I want to create a report template for a tabular form should have more than 4 column template conditions (more than 12 conditions i need) to get the coloring for row based on the conditions.
    so, please tel me how to do a template to meet my requirements.
    APEX VERSION: 4.2
    Database :11gR2.
    Cheers
    Tulasi.

    Tulasi 1243 wrote:
    Hi
    I want to create a report template for a tabular form should have more than 4 column template conditions (more than 12 conditions i need) to get the coloring for row based on the conditions.
    so, please tel me how to do a template to meet my requirements.
    VC wrote:I don't think it is possible using the template column conditions...try using some jQuery code that runs on page load.
    I am sure this has been discussed here before. Search the forum...good luck.It is possible using a template, and it has been discussed many times...
    The trick is to combine classTyler's conditional <tt>class</tt> technique with a custom named column report template.
    Determine a class for the row in the query:
    select
              empno
            , ename
            , sal
            , case
                when sal < 1000 then 'low'
                when sal between 1000 and 2000 then 'medium'
                when sal > 2000 then 'high'
              end sal_class
    from
              empCreate a custom named column report template, referencing the class in the row template:
    <tr class="#SAL_CLASS#"><td>#EMPNO#</td><td>#ENAME#</td><td>#SAL#</td></tr>Then create a style sheet to apply the required backgrounds:
    tr.low td { background-color: yellow; }
    tr.medium td { background-color: white; }
    tr.high td { background-color: red; }

  • How to select a specific column in a bean method?

    Hey everyone,
    I'm trying to select a specific column in my adf table so i can hightlight the ones i can after, with a method bean that does a match from another table. I'm using JDeveloper 12.1.2.0.0.
    Here's my table at the moment (its a static list that Timo and Alejandro helped me create, thanks to them again!):
    <af:table value="#{bindings.Anos1.collectionModel}" var="row"
                                                              rows="#{bindings.Anos1.rangeSize}"
                                                              emptyText="#{bindings.Anos1.viewable ? 'No data to display.' : 'Access Denied.'}"
                                                              rowBandingInterval="0" fetchSize="#{bindings.Anos1.rangeSize}"
                                                              filterModel="#{bindings.Anos1Query.queryDescriptor}"
                                                              queryListener="#{bindings.Anos1Query.processQuery}"
                                                              filterVisible="false" varStatus="vs" id="t5"
                                                              styleClass="AFStretchWidth" columnSelection="multiple"
                                                              inlineStyle="max-width:100%;" columnStretching="multiple"
                                                              columnSelectionListener="#{ControlBean.onAnoColumnSelect}"
                                                              disableColumnReordering="true"
                                                              binding="#{ControlBean.dimAnos}">
                                                        <af:column sortProperty="#{bindings.Anos1.hints.A2011.name}"
                                                                   filterable="true" sortable="false"
                                                                   headerText="2011"
                                                                   id="c54" width="16%">
                                                            <af:outputText value="#{row.A2011}"
                                                                           shortDesc="#{bindings.Anos1.hints.A2011.tooltip}"
                                                                           id="ot54">
                                                                <af:convertNumber groupingUsed="false"
                                                                                  pattern="#{bindings.Anos1.hints.A2011.format}"/>
                                                            </af:outputText>
                                                        </af:column>
                                                        <af:column sortProperty="#{bindings.Anos1.hints.A2012.name}"
                                                                   filterable="true" sortable="false"
                                                                   headerText="2012"
                                                                   id="c55" width="16%">
                                                            <af:outputText value="#{row.A2012}"
                                                                           shortDesc="#{bindings.Anos1.hints.A2012.tooltip}"
                                                                           id="ot55">
                                                                <af:convertNumber groupingUsed="false"
                                                                                  pattern="#{bindings.Anos1.hints.A2012.format}"/>
                                                            </af:outputText>
                                                        </af:column>
                                                        <af:column sortProperty="#{bindings.Anos1.hints.A2013.name}"
                                                                   filterable="true" sortable="false"
                                                                   headerText="2013"
                                                                   id="c56" width="16%">
                                                            <af:outputText value="#{row.A2013}"
                                                                           shortDesc="#{bindings.Anos1.hints.A2013.tooltip}"
                                                                           id="ot56">
                                                                <af:convertNumber groupingUsed="false"
                                                                                  pattern="#{bindings.Anos1.hints.A2013.format}"/>
                                                            </af:outputText>
                                                        </af:column>
                                                    </af:table>
    I've deleted some of the columns because they are all equal and by doing so, you have less problems in reading it.
    In my method i have a matchEm but i'm trying to select a column by using this line:
            dimAnos.setColumnSelection("A2012");
    dimAnos is the binding for my table Anos (Years in Portuguese). I even tried another values fro the columnSelection but i couldn't make it selected. Am i doing anything wrong?
    Please help me or give me an idea of how can i do this.
    Regards,
    Frederico.

    Hi Frederico,
    The method setColumnSelection is meant to set whether your table supports column selection or not. It doesn't select the column. In order to select the column, you need to set the column attribute Selected to true. So I don't know if its an option for you but you can create a binding to all the columns you have in you bean, and then call the method A2012.setSelected(true), and then add a partial target to the table to re render it and show the selected column.
    Hope this helps

  • How to find out the selected column in Table Control

    Hi all,
          How to find out the selected column in Table Control?
    Thanks & Regards,
    YJR

    Hi,
    Let your table control name in Screen painter be TC1.
    READ TABLE TC1-COLS INTO WA_COLS (some wok area)
                 WITH KEY SELECTED = 'X'.
            IF SY-SUBRC = 0.
              CLEAR: W_DUMMY, W_COL_NAME.
              SPLIT WA_COLS-SCREEN-NAME AT '-' INTO W_DUMMY
                                                   W_COL_NAME.
            endif.
    W_COL_NAME gives you the column name.
    Hope it helps.
    cheers
    sharmistha

  • How to select data from a table using a date field in the where condition?

    How to select data from a table using a date field in the where condition?
    For eg:
    data itab like equk occurs 0 with header line.
    select * from equk into table itab where werks = 'C001'
                                                      and bdatu = '31129999'.
    thanks.

    Hi Ramesh,
    Specify the date format as YYYYMMDD in where condition.
    Dates are internally stored in SAP as YYYYMMDD only.
    Change your date format in WHERE condition as follows.
    data itab like equk occurs 0 with header line.
    select * from equk into table itab where werks = 'C001'
    and bdatu = <b>'99991231'.</b>
    I doubt check your data base table EQUK on this date for the existince of data.
    Otherwise, just change the conidition on BDATU like below to see all entries prior to this date.
    data itab like equk occurs 0 with header line.
    select * from equk into table itab where werks = 'C001'
    and <b> bdatu <= '99991231'.</b>
    Thanks,
    Vinay
    Thanks,
    Vinay

  • How to export only selected columns of WD ALV to excel

    Hi,
    I have WD ALV report with EXPORT button (since standard button was not working properly i just hide that and added custom one) & standard dropdown to choose layout. Out of 20 columns user may choose n number of columns, the same number of columns i need to transfer to xls. How to export only selected columns to xls. Any method or FM to filter number of columns being transfer to xls. please advise
    Rgds
    sudhanshu

    Hi,
    Where exactly we are (or going to be) using this reference i.e., CL_SALV_WD_CONFIG_TABLE. Im passing contents, filename & MIME type as:
    call function 'SCMS_STRING_TO_XSTRING'
        exporting
          TEXT   = TEXT
        importing
          BUFFER = XTEXT.
    WDR_TASK=>CLIENT_WINDOW->CLIENT->ATTACH_FILE_TO_RESPONSE(
    **path to the word file
        I_FILENAME = 'WDP.xls'
    String Variable
        I_CONTENT =  XTEXT
    File Type
        I_MIME_TYPE = 'EXCEL' ).
    In CL_SALV_WD_CONFIG_TABLE we have few methods related to column settings however not sure where exactly we will be using this class reference. can you please give some idea so that i can do some r&d in that.
    Rgds
    Sudhanshu

  • How to put image in table selection column in advanced table

    i need to put some image(not a picture, its just a traingalur shape image with different colour which indicates some messages to the user if suppose user adds a data which is duplicate with other row or he may copy existing row and dont change it.) can any one give me an idea of how to achieve this

    Are you looking for image in selection column or as a separate column?
    --Shiv                                                                                                                                                                               

Maybe you are looking for

  • Drop down for a field in a table

    hi friends,    need a help from u, how to maintain the drop down for a field in a table.. advance thanks..

  • Abap object oriented

    Hi experts., i am very new in  abap oo . please give me documentation and if possible sample   code. thanks in advance,

  • Oracle export file as source

    Hi, I'm new to this group and to OWB as well. I am re-building in OWB a small sample application that I have previously built in another ETL tool. One of the source files to be processed in this application is an Oracle export file. I have tried, and

  • PC Video screen capture for AE importing?

    Does anybody know of a good screen capturing utility for the PC that I can import the files of into AE? Currently Im using Camstudio but the results Im getting are very poor and when I import them into AE it doesnt handle them very well at all (very

  • Current date - End of the week

    Hi Masters, By using <b>GET_WEEK_INFO_BASED_ON_DATE</b> this function module we can find the last day of the week. That is it's giving SUNDAY. But my case SAT DAY is the last day of week. Please can any body give me the proper code..It's very urgent.