Retrieve only first line that satisfy the condition

Hello

I have the following table

create the table authabs as

(

Select 1 empid, 100 absmins, would be "type of Union double all the"

Select 1 empid, 200 absmins, type 'P' of all the double union

Select 2 empid, 300 absmins, would be "type of Union double all the"

Select 3 empid, 400 absmins, would be "the double type

);

The following query returns two rows.

Select * from authabs where empid = 1;

But I want to just go back to a row (in top or one of the lines).

I use oracle 10 g

Help, please

Using rownum...

Select * from authabs where empid = 1 and rownum = 1;

For reference the Rownum!

https://docs.Oracle.com/CD/B28359_01/server.111/b28286/pseudocolumns009.htm#SQLRF00255

Tags: Database

Similar Questions

  • How to remove the lines that have the employee name double?

    Hello world

    Greetings

    I'm using oracle 11g.

    Suppose I have a table and I want to delete lines that have the name used twice?

    So given below is my table so I only delete lines that have more than one 'Ram' and 'Dilip' ename.

    How to do this?

    EmpID Ename salary Commission depnto
    101RAM50004531
    102RAM60007652
    103Sisi34568763
    104Dilip76566754
    105Mohan98787675
    106Dilip56469876
    107Ganesh98234557

    You can use a simple code as follows

    Delete From EMP

    Where rowid! = (select min (rowid) of the group by Ename EMP);

    For preserved older values using 'min (rowid)'

    and for the most recent values required use "max (rowid)"

    Thank you.

  • Is it possible for an index that includes the condition 'GOLD '?

    Hello, I have a few questions.

    The test was conducted in the following procedure.

    ################################
    create table test
    (
    VARCHAR2 (10) C1.
    C2 varchar2 (10),
    key (c1) elementary school

    );

    create index test_idx1 on test (c2);

    Command > explain select * test where c1 = 'JOHN' or c2 = "JOHN";

    Query optimizer plan:

    STEP: 1
    LEVEL: 1
    OPERATION: RowLkRangeScan
    TABLENAME: TEST
    IXNAME: TEST
    CONDITION INDEX: < NULL >
    NOT INDEXED: TEST. C2 = 'JOHN' OR TEST. C1 = 'LUCY '.

    Command >


    Command > explain select * test where c1 = 'LUCY' and c2 = "ABDELLAH.

    Query optimizer plan:

    STEP: 1
    LEVEL: 1
    OPERATION: RowLkRangeScan
    TABLENAME: TEST
    IXNAME: TEST
    INDEXED CONDITION: TEST. C1 = 'ABDELLAH.
    NOT INDEXED: TEST. C2 = "ABDELLAH.

    Command >
    ################################

    By adding the status of "GOLD" in this test does not use the index.

    Is it possible for an index that includes the condition 'GOLD '?

    Thank you.

    GooGyum.

    A database can generally use indexes in this way for one 'or' with two different columns. However, for this example specific can easily rewrite the query using 'UNION' to use the relevant hints while still giving the same result (correct):

    Command > explain select * from t1 test where t1.c1 = 'LUCY' union select * test t2 where t2.c2 = "JOHN";

    Query optimizer plan:

    STEP: 1

    LEVEL: 1

    OPERATION: RowLkRangeScan

    TABLENAME: TEST

    IXNAME: TEST

    INDEXED CONDITION: T1. C1 = 'ABDELLAH.

    NOT INDEXED:

    STEP: 2

    LEVEL: 2

    OPERATION: RowLkRangeScan

    TABLENAME: TEST

    IXNAME: TEST_IDX2

    INDEXED CONDITION: T2. C2 = "ABDELLAH.

    NOT INDEXED:

    STEP: 3

    LEVEL: 1

    OPERATION: OrderBy

    TABLE_NAME:

    IXNAME:

    INDEXED CONDITION:

    NOT INDEXED:

    STEP: 4

    LEVEL: 2

    OPERATION: UnionMergeSort

    TABLE_NAME:

    IXNAME:

    INDEXED CONDITION:

    NOT INDEXED:

    Maybe you can apply something similar? If you know that there is no possibility of duplicate lines then you can optimize it (in terms of performance) by using UNION all.

    Chris

  • First line indent except the first line of a paragraph

    Hello

    I would create a paragraph style with a first line indent, with the exception of the first line, which I have no dash.

    Attached an example of how I want it to look.

    Best regards

    Vincent

    Schermafbeelding 2016-07-29 om 11.01.28.png

    You need a second style to the first paragraph. Based on the other model and the withdrawal of first line value of 0.

  • No puedo open only first creative cloud, no the opcion open viene desde.

    No puedo open only first creative cloud, no the opcion open viene desde.

    You MUST have a 64-bit computer what is your computer?

    MINIMUM for After Effects and Premiere Pro http://helpx.adobe.com/premiere-pro/system-requirements.html

  • How can I prevent intenting acrobat each line that follows the first when rendering a HTML tag via the context menu under windows?

    When I create a PDF file by right clicking on a HTML file and choosing "convert to PDF" the first line of each paragraph is in place, but all lines after the first caters a bit.

    intented_in_pdf.jpg

    When I open the created PDF file and choose "Change the texts and images" in the Acrobat line the first and the rest of the paragraph were created in boxes separated with this little intention on the second square.

    editing_pdf.jpg

    How can I configure right Acrobat to show the paragraphs correctly?

    Because I create multiple PDF files every day, I don't want to manually set each PDF.

    OK, I discovered that there are remnants of an old installation of Acrobat in the system. I removed the old parts uninstalled Acrobat, rebooted the PC and reinstalled Acrobat. Now, everything's fine.

  • Can I get the total number of records that meet the conditions of a query using the Table API?

    Hello

    A < row > TableIterator is returned when I ask operations using the index of tables. If I want to get the total number of records, I count one by one using the returned TableIterator < row >.


    Can I get the total number of records directly meets the conditions of the query?

    I can get the total number of records directly the request of the meeting of the conditions of CLI using the command Global table - name tableName - count - index index-name-field fieldName - start startValue-end endValue.

    Can I get the same results using the Table API?

    I used MongoDB and NoSQL Oracle for about a year. According to the experience of the use of these dbs, I think mongoDB querying interface is powerful. In the contras, the query interface is relatively simple, which results is a lot of work that is usually a long time in the client side.

    Hello

    Counting records in a database is a tricky thing.  Any system that gives you an accurate count of the records will have a hotspot of concurrency on updates, namely the place where the counting is maintained.  Such a count is a problem of performance in addition to competitive access problem.   The problem is even more difficult in a system widely distributed such a NoSQL database.

    The CLI has overall command that counts, but does so by brutal force - iterate keys that correspond to the parameters of the operation.  This is how you must do this within the API.  There is not a lot of code, but you have to write.  You certainly want to use TableIterator TableAPI.tableKeysIterator (), because a key iteration is significantly faster than the iteration of lines.  Just one iteration and count.

    If you use TableAPI.multiGet () and a key with a touch of brightness full then, in fact, count the results as they are returned in a single piece (a list).

    Kind regards

    George

  • Text box formatting withdrawal negative first: first line begins on the left, the rest is on the right.

    InDesign CS6 finally arrived less than two weeks before I need the preliminary version of a major publication. I used last InDesign version 3 or 4. I used Publisher lately. I'm half way through the manual ID so direct me to a page number if this is the answer in there.

    I want the first line of a paragraph in my text box to start on the left, then jump to a tab where more text begins. Until then, the text would wrap tab if it is long enough. Then the process begins again with the following paragraph in the same text box. I would like this formatting be automatic, with not much fuss on my part to do at work - and run around (not on top of) pictures on the right.

    It should look like this:

    -----

    Funding: Funding goes here. It is long.
    It wraps to the point the tab to the 'a '.

    Description: A description goes here. It is long.
    It wraps to the point the tab to the 'a '.

    -----

    In Word, do you it by pulling the back 'home' to the right, where it aligns with the tab, and it is called a "hanging indent."

    Is it possible (easily) in InDesign? Or do I have two areas of text with the vertices lined up, to get two different margins 'left'?

    I tried to do it with a table but sometimes the table gets too long and the bottom line or two disappears, even if the blue lines are way big... and the text is not flowing around the photos to the right, so I have to keep narrow if the type is not on the top of the photo. This is not the effect I want! My last page model has seven two columns, a table of line that is not an ideal solution either because I have to manually set the gaps between paragraphs and tables - and the text isn't always in circulation around the photos.

    Help!

    Peter's suggestion works if you prefer justified left, titles that show you in your example. Indent to here works when you want to right justified titles that I show in my example.

  • query to view separate lines that have the same values

    Hello

    I have the columns id, addr1, addr2, city and State of coding. I need to know all the coding IDS that have the same addresses and at the same time filter out the same side of the id of the request.

    For example:

    acctid addr1, addr2 City State

    WEF 1 101 101 sd

    1                         101          wef     sd

    WEF 2 101 101 sd

    WEF 3 101 101 sd

    DC 4 102 102 homeless

    From the above data, I want to get filter tier 4 and get lines 1, 2 and 3. How to achieve with a sql query

    Thank you

    Arch

    This has nothing to do with hard... coding is how you test a query without creating the table, so you'd:

    with match_finder AS (SELECT acctid, addr1, addr2, city, State, count (*) OVER (PARTITION BY addr1, addr2, city, province) AS identical_rows)

    OF )

    Select acctid, addr1, addr2, city, province

    of match_finder

    where identical_rows > 1

    /

    and the rest, I'm sure, you can find on your own...

    HTH

  • Get the first line selected on the CommandButton Click

    Hi guys,.
    My version of jdev is 11.1.1.5.0. I have table on my Page of Adf.

    < af:table value = "#{bindings." MyvwVO1.collectionModel}.

    var = "row" rows = "#{bindings." MyvwVO1.rangeSize}.

    emptyText = "#{bindings." MyvwVO1.viewable? "{'No data to display.': 'Access Denied.'}".

    filterModel = "#{bindings." MyvwVO1.queryDescriptor}.

    queryListener = ' #{bindings. " MyvwVO1.processQuery}.

    filterVisible = "true" varStatus = 'vs' rowBandingInterval = '1 '.

    columnSelection = 'single '.

    Summary = "Table of suppliers.

    selectionListener = "#{bindings." MyvwVO1.collectionModel.makeCurrent}.

    rowSelection = "single" id = "t2".

    "partialTriggers =": soc1: ctb2: cb22.

    fetchSize = "#{bindings." MyvwVO1.rangeSize}.

    Binding = "#{MyBN.supplierTableBinding}" >

    < af:column id = "c14" frozen = "true" align = "center" >

    < af:commandButton action = "viewNext" text = "Next view" id = "cb1" >

    < af:setActionListener from = "#{bindings." CurrSupplierSiteId.inputValue}.

    to = "#{bindings." SupplierSiteID.inputValue} "/ >"

    < af:setActionListener from = "#{bindings." CurrSupplierSiteId.inputValue}.

    to = "#{MyBN.supplier_site_id}" / >

    < / af:commandButton >

    < / af:column >


    When I'm clicking viewNext button. When debugging, I get first line provider site Id instead of the current line selected.

    I also removed the selectedRowKeys of af: table. Now his show is not first line select default, but still get the Site Id of first line supplier back Bean.

    {} public void setSupplier_site_id (number supplier_site_id)

    This.supplier_site_id = supplier_site_id;

    }

    public {getSupplier_site_id() number

    Return supplier_site_id;

    }

    No idea what I'm doing wrong.


    Thank you

    Raul

    you pass line value.right... so from value as link will not be work.try send as #{row.abc.value} go on setactionListener and so on. You pass the rank value.

  • How to get the line blank if the condition does not match

    Hello..

    I have 2 tables
    create table chk1 (no , nm )
    as select 1,'abc' from dual union all
    select 2,'bcd' from dual union all
    select 3,'cde' from dual
    
    
    create table chk2 (no , nm )
    as select 1,'abc' from dual union all
    select 1,'bca' from dual union all
    select 2,'cde' from dual union all
    select 2,'dce' from dual union all
    select 3,'cde' from dual
    There are 2 rows of chk2 table for each record in the table of chk1.
    Off 2 rows if a line is missing any rank must be printed as a blank line

    I wrote the following query but of no use...
    could you help me in this
    select * from chk1 c1,chk2 c2
    where c1.no=c2.no(+)
    Thank you

    Hello

    You can do this:

    SELECT *
    FROM   chk1 c1,
           (SELECT NO,
                   nm
            FROM   chk2
            UNION ALL
            SELECT   NO,
                     NULL
            FROM     chk2
            GROUP BY NO
            HAVING   COUNT(*) < 2) c2
    WHERE  c1.NO = c2.NO(+)
    
    NO     NM     NO_1     NM_1
    1     abc     1     abc
    1     abc     1     bca
    2     bcd     2     cde
    2     bcd     2     dce
    3     cde     3     cde
    3     cde     3     
    
  • IFF select all lines satisfy the condition

    Hello

    I am not able to understand how to go about this requirement of mine. I use APEX 3.1.

    I have a table of expiration dates. I want to select only the company_id, all with dates were expired (to_date(sysdate,'DD-MON-YY') < = to_date(expiration_date,'DD-MON-YY').)

    Table:

    table_id | COMPANY_ID | correspondents

    1. 2. 10 APRIL 09
    2. 3. 10 APRIL 09
    3. 2. AUGUST 10, 10
    4. 1. 10 APRIL 09
    5. 1. 10 APRIL 09

    power required:
    table_id | COMPANY_ID
    2. 3
    4. 1
    4. 1

    Thank you
    Monpetit

    Published by: user11267485 on August 18, 2009 11:31

    Published by: user11267485 on August 18, 2009 11:32

    Frank & I posted two queries return the expected results for the data set, that you posted.

    SQL> ed
    Wrote file afiedt.buf
    
      1   with x as (
      2     select 2 table_id, 2 company_id, date '2009-04-10' exp_date from dual
      3     union all
      4     select 1226, 2, date '2010-08-06' from dual
      5     union all
      6     select 1265, 1348, date '2009-04-09' from dual
      7     union all
      8     select 1266, 1348, date '2009-04-09' from dual
      9   )
     10   select table_id, company_id
     11     from (select table_id,
     12                  company_id,
     13                  max( exp_date ) over (partition by company_id) last_exp_dat
    e
     14             from x)
     15*   where last_exp_date < sysdate
    SQL> /
    
      TABLE_ID COMPANY_ID
    ---------- ----------
          1265       1348
          1266       1348
    

    Are you sure that the data in your table are all of the years 2009 and 2010? You post only here two-digit year. I bet if you look at the full 4-digit year that you will eventually discover that TABLE_ID 1226 has an expiration date of August 6, 0010, i.e. approximately 1999 years.

    Justin

  • I'm trying to reduce the duration of the google navigation and search boxes without any succuss. Numerious times the site was requested, but no response is the problem. I can change the size by using the line that separates the two boxes, but I only

    I added a cus 06/25/10, wanted to shorten the google search and navigation bars to see, but can't. Have re-installed the google toolbar, have chosen the version of firefox as my default tool bar and can then change the width, but when a box shortens the other if extension always fill the width of the screen. Customize toolbar doesn't give any options to reduce the width of toolbar, I am at a total loss. Would love suggestions if you have correctly fixed this.

    This has happened

    Each time Firefox opened

    is 25/06/10

    The address bar and the search bar have a flex property and take all available space.
    You can change the relative size of the two with this resizer between two bars.
    You can only do this by adding a lot of space in the view > toolbars > customize window.

    You can set a fixed width by defining the min-width and max-width for the same value.

    Add code to userChrome.css below @namespace.
    See http://kb.mozillazine.org/Editing_configuration#How_to_edit_configuration_files

    @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */
    
    #urlbar-container {max-width:400px!important; min-width:400px!important;}
    #search-container {max-width:200px!important; min-width:200px!important;}
    

    You can choose your own values as long as the min-width and max-width for each bar have the same value.

  • XMLTABLE returns only first line

    I now XML inserted in the column named as TEXT in the MASTERTB table.

    * <? XML version = "1.0" encoding = "utf-8"? > *.
    "< * Rowsets DateCreated =" "2010-11 - 30 T 11: 12:10" EndDate = "2010-06 - 05 T 16: 52:23 ' StartDate =" "2010-06 - 05 T 16: 52:23" Version = "Build 12.0.10 (18)" > * "
    * < Rowset > *.
    * < columns > *.
    * < Description = "Material number" column MaxRange = '1' MinRange = '0' Name = 'MATERIAL' = '1' = 'MATERIAL' SourceColumn SQLDataType / > *.
    * < column Description = "" MaxRange = '1' MinRange = '0' Name = 'TANK' = '1' = 'TANK' SourceColumn SQLDataType / > * "
    * < / columns > *.
    * < row >. *
    * < MATERIAL > 1000000144 < / EQUIPMENT > *.
    * < T1000 TANK > < / TANK > *.
    * < / row > *.
    * < row >. *
    * < MATERIAL > 2000000008 < / EQUIPMENT > *.
    * < T1000 TANK > < / TANK > *.
    * < / row > *.
    * < row >. *
    * < MATERIAL > 2000000009 < / EQUIPMENT > *.
    * < T1000 TANK > < / TANK > *.
    * < / row > *.
    * < row >. *
    * < MATERIAL > 2000000016 < / EQUIPMENT > *.
    * < T1000 TANK > < / TANK > *.
    * < / row > *.
    * < row >. *
    * < MATERIAL > 3000000036 < / EQUIPMENT > *.
    * < T1000 TANK > < / TANK > *.
    * < / row > *.
    * < / lines > *.
    * < / sets of lines > *.

    Now my requirement is to get all material values, so when I run the following question in Oracle,.

    SELECT RW. MATERIAL
    OF MASTERTB TM,.
    XMLTable ('/ / row ' PASSAGE TM.) TEXT
    COLUMNS "MATERIAL" CHAR (30) PATH 'MATERIAL') AS RW

    He returned only 1000000144 (RAW material). How can I read all the MATERIAL? In addition, how to read the XML all in text format if I want to check what has been inserted?

    Any help will be appreciated!

    Edited by: 967327 October 27, 2012 12:28

    Do you know how I can see that XML is stored in the TEXT column in the MASTERTB, because when I d select * from MASTERTB, it just gives me "-" in the column of TEXT. Somehow the statement select is not capable of converting XMLTYPE chain. So can you help me to retrieve the whole XML stored in the column of TEXT.

    You have access to another customer tool Oracle like SQL * Plus or SQL Developer?
    It would be useful to test your queries on one of those to the first rule of any problem in the database.

    Regarding your question on the extraction of all the XML content, the answer depends on the version of database, that you don't mention.

    Before 11 g, use the getClobVal (or getStringVal):

    SELECT tm.text.getClobVal()
    FROM MASTERTB tm
    

    The foregoing is deprecated in 11.2, so if you're on 11g:

    SELECT XMLSerialize(document tm.text)
    FROM MASTERTB tm
    

    http://docs.Oracle.com/CD/E11882_01/AppDev.112/e23094/xdb13gen.htm#ADXDB5033

  • The difficulty to pass the black diagonal line that follows the clips in WLMM believe its called the toolbar. Sometimes it 'moves' and other times it will not move

    This question is more than 6 characters. I'm unable to move the black diagonal line preceding each video clip in WLMM, believe he is called to the toolbar. Sometimes when I left click it will move for me and sometimes it does not move or go anywhere. What I am doing wrong? In addition, there are a clip in particular that the toolbar will not pass through the play. Like the above, sometimes it works and sometimes not.

    Hello

    Given that the problem is related to Windows Live Movie Maker, I suggest that ask you your question in Windows Live Solution Center.

    Movie Maker - Windows Live Solution's portal

Maybe you are looking for

  • Sync ITunes broken 12.5.1

    I've also updated my IPhone to OS 10.0.2 lasest and ITunes for 12.5.1 and synchronization is now broken. The phone does not even get detected in ITunes, but OS 10 Windows detects the phone in the Device Manager.

  • Irregular disk space

    Hello I wanted to check how much free space I have on my mbp 13 retina (mid-2015) ssd. The system says I 217 free Go (on 251), while showing that applications use 123 Go. Here is the screenshot: Any idea on what is happening?

  • Lenovo 3000 Y410 - How portable bluetooth enabled.

    Hello I have lenovo 3000 Y410 laptop. I looked in the forums, some of the forums mentioned that some models of Y410 laptop does not have bluetooth. Can you if it all please let me know how to find my mobile phone supports bluetooth? Thanks in advance

  • Pavilion x 64: HP Photosmart C4480

    I recently bought the HP Pavilion x 64 PC laptop, but my HP Photosmart C4480 will not be installed by using the startup disk.  The message says it's incompatible.  I can't believe that I have this gap because it is a very good printer even though old

  • How to re-enable Windows 7 after replacing the motherboard.

    I managed to replace the motherboard in an Acer Aspire v3 and all is well (or almost). Only problem is that Windows 7 requires now that I'm using an illegal copy of Windows. I know that the reason is that the version of Windows OEM is selected with t