How extract records where "COUNT(Col1) 1

Hi guys
I've this table
TAB1
ACC_ID       NUM_TRANS
  55892569          0
   55892569          1
   55892569          1
  44420080         1
168865070          0
168865070           1
168865070           1
I need to get all account_id with a count(num_trans) > 1
When I write
Select acc_id,count(num_trans)
from TAB1
group by ACC_ID 
But how to get only the ACC_ID which have a COUNT(NUM_TRANS) > 1
without creating a Temporary Table ?
This should be the result
ACC_ID       NUM_TRANS
  55892569          2
  168865070           2

Hi, Just try the below
Select  acc_id, count(num_trans)
from Tab1
group by Acc_id
IF you want to only >0 counts you can add having condition
Select  acc_id, count(num_trans)
from Tab1
group by Acc_id
Having count(num_trans) >0

Similar Messages

  • JDBC: How  to select only those records which contains col1 is NULL

    Hi All,
    In JDBC SELECT scenario.
    I wants to select only those records which contains col1 is NULL.
    I am trying as follows:
    <key>
    <col1 isNull="TRUE" />
    </key>
    but in moni/monitoring i am getting Following Error
    006-12-01 19:35:20 Error Unable to execute statement for table or stored procedure. 'BG_SALARY_SEND_SAP_D' (Structure 'SELECT') due to java.sql.SQLException: FATAL ERROR document format: structure 'SELECT', key element 'key' contains no values
    2006-12-01 19:35:20 Error Exception caught by adapter framework: Error processing request in sax parser: Error when executing statement for table/stored proc. 'BG_SALARY_SEND_SAP_D' (structure 'SELECT'): java.sql.SQLException: FATAL ERROR document format: structure 'SELECT', key element 'key' contains no values
    Please suggest how to do select rows with col1 is null.
    Regards

    Rohan,
    isNull= true is used to make the KEY element not mandatory.
    In your case, if the select query is
    select emp from emptest where empno is null
    , then the datatype will be,
    <root>
    <StatementName>
    <dbTableName action=”SELECT”>
      <table>emptest</table>
    <access>
    <emp></emp>
    </access>
    <key1>
    <b><empno hasQuot="NO">is null</empno></b>
    </key1>
    </dbTableName> 
    </StatementName>
    </root>
    I dont have a DB access to try this, but I think this should work.
    If this doesnt work, then you would need to use SQL_QUERY,
    <root>
    <StatementName>
    <anyName action=” SQL_QUERY”>
    <access>select emp from emptest where empno is null</access>
    </anyName > 
    </StatementName>
    </root>
    http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
    Regards,
    Bhavesh

  • How to know the count of record in CR XI?

    Post Author: Liu ming
    CA Forum: Deployment
    Hi All,
    I create a report by CR XI release 2. The report is viewed in ASP.Net. So, I would like show a message when the report have no record. My question is how to know the count of record?
    Thanks.

    I was able to do this by using
    ora:countNodes('Receive_1_Read_InputVariable','BILL','/ns2:BILL/ns2:CMS1500')

  • How to get the count of the records

    Hi all,
    how can we get the record count after the read statement.Means if we write a read statement based on a condition,then how can we know that how many records get effected for this read statement

    You can use loop statement to read the records and write in some internal table and after the end of the loop, you can use describe command to find the number of records.
    For eg. DESCRIBE TABLE tablename LINES lines.
    Here the "Lines" field will give the total number of records present in the table "tablename"

  • Need Photoshop action to record WHERE on canvas a layer is placed, NOT how many pixels it was moved.

    Hello everyone,
    I'm pulling my hair out trying to figure this out.
    I created an action:
    I have a bunch of PSD files of some pretty expensive rings that were shot at hi-res and cropped.
    Now, i have a canvas that is 996x1104 px.
    All of these rings must sized to 540px width AND positioned on the canvas at x:498px and y:706 (the bottom of the layer must touch 706px, which I did by clicking on the little tiny box at the bottom of the little square made of little squares (that's next to the x and y positions when you are on Transform mode).
    I made an action for all of these steps.
    However, when I batch a group of these hi-res ring PSDs and apply the action,
    they are always in different spots. They all need to be set on y:706px so it looks like they are all resting on the same plane.
    I found out why this is happening:
    because when I position the ring when creating the action, Photoshop records HOW MUCH in pixels I moved the layer... NOT WHERE ON THE CANVAS IT'S POSITIONED.
    This is what I need: to have Photoshop record WHERE on the canvas the layer is positioned.
    Can anyone help?
    We have so much work to do by Monday and setting up this action would definitely help us.
    Thanks so much!
    _Chris

    Did you try settings the rulers units to Percent before recording the action and see if that makes a difference?
    You might possibly need a script for your goal, in which case you could ask over on the photoshop scripting forum:
    http://forums.adobe.com/community/photoshop/photoshop_scripting

  • How can I set limitations on how many records a report can return

    I have a report on the web using Oracle Reports builder and I have the client enter in date parameters for the report that they want.
    Well with date ranges for different clients a different number of records are returned. Because of time it can take the report to return I want to limit the number of records that report can return.
    How can I go about doing that? I don't want to limit with date parameters because date won't really work for me. I need to limit on how many records can be returned. If it exceeds 10,000 records I want the client to refine the date range of schedule the report to run later. Meaning we will run that report. So I would have two check boxes if the count was over 10,000 do you want to define your date or schedule the job to run later.
    Can any one help me with this? How would I go about this?

    To know if the report is going to return more than 10,000 records, you first have to run the query with a 'select count(1) from ... where ...' (with the same from and where clauses as you normal query). Since this takes about the same time as runnng your report, I wonder if you really gain anything (although formatting may take some time too).
    You may simplify the select count(1) query by omitting all the lookup tables that are only needed for formatting. That way your query may run a lot faster. You can put this in your after parameter form trigger.

  • How to get the count of each minutes

    Oracle 10 DB
    Hi All
    I using this query to get the count of records fetched by the concurrent program per min,
    select count (distinct b.attribute2)
    from oe_order_headers_all a,oe_order_lines_all b
    where a.header_id=b.header_id
    and b.flow_status_code ='AWAIT_QUINTIQ_BOOK'
    and to_Char(b.last_update_date,'DD-MON-YYYY HH24:MI:SS') between '19-JAN-2011 02:00:01' AND
    '19-JAN-2011 02:00:02'
    This is used to get the count of records fetched at one mins
    How to find the count of last 10 mins ie 1 mins count 2.00 to 2.10
    Thanks & Regards
    Srikkanth.M

    Try this:
    SELECT TRUNC(b.last_update_date, 'mi') time_mins, COUNT(DISTINCT b.attribute2)
    FROM   oe_order_headers_all a,
           oe_order_lines_all b
    WHERE  a.header_id = b.header_id
    AND    b.flow_status_code = 'AWAIT_QUINTIQ_BOOK'
    AND    b.last_update_date >= to_date('19/01/2011 02:00:00', 'dd/mm/yyyy hh24:mi:ss')
    AND    b.last_update_date < to_date('19/01/2011 02:10:00', 'dd/mm/yyyy hh24:mi:ss')
    GROUP BY TRUNC(b.last_update_date, 'mi');I'm not sure why you're bothering with the join to the oe_order_headers_all table, since you're not referencing that in the where clause or the selected columns list. I think you could probably do away with it.
    I've changed your code to take the last_update_date and truncate it to the minute level, and added that as a column, so you can see which count goes with which minute. Obviously, this has to be in the group by.
    I've also changed your date comparisons so that you're actually comparing dates to dates, rather than strings to strings - why would you deliberately take information away from the optimizer? Oracle does not treat strings the same as dates, and forcing it to use strings rather than dates could lead you to have a vastly differing execution path, which will most likely be less performant.
    Not to mention, coding like that leads you to assume that you can compare dates in strings without any problems, and that is just not the case. '19-FEB-2011' is counted as being earlier than '19-JAN-2008', as strings sort alphabetically.

  • Report execute time nd how many records will be returned before hitting the "run" option?

    Post Author: Prasad15
    CA Forum: WebIntelligence Reporting
    Is there any way to know how long the report executes and how many records will be returned before hitting the "run" option?
    Regards
    Prasad

    To know if the report is going to return more than 10,000 records, you first have to run the query with a 'select count(1) from ... where ...' (with the same from and where clauses as you normal query). Since this takes about the same time as runnng your report, I wonder if you really gain anything (although formatting may take some time too).
    You may simplify the select count(1) query by omitting all the lookup tables that are only needed for formatting. That way your query may run a lot faster. You can put this in your after parameter form trigger.

  • MySQL database record hits counter?

    Can I find out how many times a record from the MySQL databse was called and displayed on a web browser?Basically a MySQL database record hits counter. I’m using PHP/MySQL.
     

    >to the two files that were created
    >Two files?
    Yes 2 files. In Dreamweaver CS3 & CS4 When using the "Insertà Data Objectsà Master Detail Page Set" function you must create two files:
    1. results.php
    2. detail.php
    It appears that these two files work together hand in hand. You did not specify where nor how to include an update record set that gets executed every time another record set that I want to count fires. So I combined the two as one until it was clarified. 
      

  • Problem trying to extract records from VBFA on Smartform.

    Hello
    I'm attempting to extract records from the table VBFA and my inexperience with Smartforms is start to show.
    I only want to have  1 record per handling unit. I'm extracting using VBELV, VBELN and VBTYP_N via SELECT * FROM VBFA.
    However this gives me multiple records per handling unit. There is no further field available on the record to make it unique. This is were my inexperience comes in. How do I perform the read of VBFA without using SELECT.?
    Regards
    Mike.

    Hello Brad,
    You're right, I'm trying to get am internal table to use a loop node.
    I'd like to go for the full SELECT into a table then read it and either a skip or ignore a record that is a duplication. I'm not sure of the way to achieve this though. This is the first time I've had to manipulate the data like this. Until now I've had the keys to select the data for me.
    I've currently got:
    SELECT * FROM VBFA INTO TABLE LT_VBFA
       WHERE VBELV = IS_DLV_DELNOTE-HD_GEN-DELIV_NUMB
       AND VBTYP_N = 'X'.
    Then I have LT_VBFA INTO WA_VBFA in a LOOP node .
    There needs to be some thing between the 2 nodes to prune the unwanted duplicates.
    Regards
    Mike.

  • Extract records to Desktop in flat file

    How to Extract records to Desktop in flat file.
    I am not able to do it from Syndicator,i tried many options.Some one can help.
    I want to extract the records from MDM to Desktop in Excel/Flat file format,whether it is from Data Manage or Syndicator.
    Immediate req.

    Hi Shifali,
    I want to extract the records from MDM to Desktop in Excel/Flat file format,whether it is from Data Manage or Syndicator
    - MDM syndicator is the tool to export data in MDM .
    - Data in MDM repository can be viewed and managed in MDM Data manager.
    - What ever data is present in data manager will be exported outside using MDM syndicator.using your search criteria.
    How to Extract records to Desktop in flat file.
    I am not able to do it from Syndicator,i tried many options.Some one can help.
    - Master data in MDM rep can be syndicated using MDM syndicator using 2 main formats Flat and XML.
    - For local syndication to your desktop in flat format you need to follow the bewlo steps:
    1) Create destination items manually in Syndicator under destination item tab.
    2) Map this destination item to the source fields whcih are your mdm rep fields.
    3) Use a serach critera if you wnat to filter records.
    4) Click the export button in the syndicator
    5) It will ask for the output file name and format
    6) Give a name and select teh format form dropdown in the window (it can be text,excel.access any thing)
    7) You output file is syndiacted to your local desktop.
    Follow the below link for Flat syndication:
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/60ebecdf-4ebe-2a10-cf9f-830906c73866 (Flat Syndication)
    Follow the below link for XML syndication:
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/e04fbbb3-6fad-2a10-3699-fbb40e51ad79  (XML Syndication)
    This will give you the clear distinction between the two.
    Hope It Helped
    Thanks & Regards
    Simona Pinto

  • Is there any limit on how many records a cursor can hold?

    Hi Everyone,
    This is Amit here. I want to know whether there is any limit on how many records a cursor can hold.
    I have a program in which i am creating a cursor and passing it to another procedure as an input parameter. But the count of cursor query is more than 15 Lakhs. The program is running forever.
    Just wanted to know whether the huge data is the problem.
    Thanks ....
    Regards,
    Amit

    user13079404 wrote:
    Just wanted to know whether the huge data is the problem.What do you think? How long does your code typically need to wait for the data to leave the magnetic platter of the harddisk, travel across wires and into the memory buffer of your application - for a single row?
    Now multiply that waiting for I/O time with a million - for a million rows. Or by a billion, for a billion rows.
    Is "+huge data+" a problem? Not really - it simple needs more work to get that amount of data from disk. More work means slower performance. It is that simple.
    Which is why the row-by-row approach used by many developers is wrong. You do not pull a million rows from disk and process it in PL/SQL or Java or .Net. Heck, you do not even pull 10,000 rows like that.
    The correct approach is to think data sets and use SQL to process that for you - and only return the bare minimum of data to the application layer. Maximize SQL. Minimize PL/SQL and Java and .Net.

  • How to find where the below sql is used in database

    Hi all,
    I am tring to find the below SQL in our data base where it is used?
    I had done the checking in all reports manually, But have no luck.
    But i am sure that the below sql is in our data base and having some issue on it.
    Can any one please let me know how to find where the below query is used in our database? I mean in packages/ triggers/ procedures or any where in our database
    Please find the query
    select count(sh.shipment_gid) from SHIPMENT sh, SHIPMENT_TYPE stp, LOCATION ld where (sh.shipment_gid in (select sstop.shipment_gid from SHIPMENT_STOP sstop where (sstop.appointment_delivery > trunc(TO_DATE(:1, :2), :3)) and (sstop.appointment_delivery is not null))) and (sh.is_to_be_held=:"SYS_B_0") and (sh.domain_name=:4) and (sh.insurance_policy_number like :"SYS_B_1") and (sh.perspective=:"SYS_B_2") and (sh.shipment_type_gid=stp.shipment_type_gid) and (sh.dest_location_gid=ld.location_gid(+)) and (stp.shipment_type_xid!=:5) order by ld.location_name, sh.start_time
    Regards,
    Dpk

    There is video demonstration how to import from data dictionary.
    After import you can select from the main menu: View->DDL File Editor menu item to open the DDL dialog and then click on "Generate" button on the dialog. When the DDL is generated you can search in it using "Find" button.
    Ivan

  • How can I see how often and where an image is used in the site?

    Just realized the post appeared twice as at first sending I
    got an error page (contains no data...).
    So, please do all answer to the other post, so that all
    replies get collected at one post only.
    Hello,
    please excuse my maybe dumb question but converting from
    GoLive I am still trying to find several practical effective
    workflow features in DW ...
    1. where in the sitewindow/assets or files panel can I see an
    indication at each image if and how often it is used in a site?
    2. and where can I see/check on which pages it is used?
    Thanks in advance for guiding me there ...
    bye,
    Beate

    > How do DW users know how often and where an image is
    used on the site
    > then?
    I'm not sure what the benefit is of knowing how often an
    image is used, but
    a search for the image by filename would do the trick.
    And just so you'll know, this is a peer forum, not an
    official communication
    vehicle to Adobe. We are all just users here, not Adobe
    employees.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "beatrice" <[email protected]> wrote in
    message
    news:[email protected]...
    > OK. I sent the below feature request.
    > How do DW users know how often and where an image is
    used on the site
    > then?
    > always doing a find/search?
    > in GoLive there was an simple window where all the files
    a page consisted
    > of
    > were listed plus all the files that were pointing to
    that page. such,
    > without
    > having to open a page links and image and componentes
    etc. could be
    > changed via
    > point&shoot.
    >
    > Couldn't you all think of this a being great and helpful
    and making site
    > management easy? Then send in a feature request as well,
    please.
    >
    > ...............
    > How can one know by the assets or files list if an image
    is used at all on
    > the
    > site?
    > and how many times? and on which pages?
    > This is very useful to know especially in larger sites.
    > e.g. an image should get changed on one page, now it
    would be very good to
    > see
    > if when it was used on other pages as well if it would
    make still sense
    > there
    > when changed.
    > as DW can update files (when e.g. an image name gets
    changed) there is a
    > way
    > this is already recorded. why not take this records and
    send this back
    > into a
    > list/column in the files panel to indicated that the
    image is used and
    > how
    > many times.
    > plus to have another window that can display all the
    pages the image is
    > used
    > in.
    > so one could click through all those pages and open them
    to check the
    > image
    > there.
    > in GoLive that feature was called 'In and Out links' and
    one could see a
    > page
    > in the middle and left and right from it many
    branches/lines at which ends
    > the
    > filenames were visible used in that page.
    > so one e.g. could also point and shoot from this list
    and change a file or
    > image or component simply by point and shooting to the
    files panel without
    > having to open the pages.
    > These features were so practical for an effective daily
    workflow that I
    > don't
    > understand why they haven't been put into cool DW yet.
    Please, please do
    > so in
    > the next release. I can test it thoroughly if you need
    testers for it.
    > bye,
    > beate
    >

  • How to handle where xmltype has empty elements

    Here is my problem:
    I have some information stored in table1 and some information in table2.These tables are joined with a key.
    Table2 has an xmltype column. That stores if
    anything (any info) has been overridden. That is has changed. There is information in this table even when nothing is overridden. In that
    case the xmltype has blank elements.
    In my query I have to display all records where the information has been overridden.That is fine as I extract from xmltype column using xmlsequence.
    The issue arises when I need to display information when it is not overridden. In that case since the xmltype has empty
    elements, the query doesnt return anything (NO RECORDS).Here it is not overridden
    <?xml version="1.0" encoding="UTF-8"?>
    <O><AR></AR>
    </O>Here is an example where it is overridden</br>
    <?xml version="1.0" encoding="UTF-8"?>
    <O><AR>
         <L id="A">
              <LL>4</LL>
         </L>
         <L id="B">
              <LL>2.5</LL>
         </L>
    </AR>
    </O>My query is something like:
    select....
    ,extractValue(k.column_value,'/L/@id') as lt,
    extractValue(k.column_value,'/L/LL') AS ll,
    FROM TABLE1 T1, TABLE2 T2,
    , table(xmlsequence(T2.XMLCOL.extract('/O/AR/L')))k
    WHERE ...So to tackle this problem of nothing being returned just because xmltype doesnt have overridden values, i have a query (using union to other)
    that says select null for the xmltype elements that I am selecting.
    I handle null as follows:
    select null as lt,null as ll......
    from ....This returns me a row even if something is overridden. I want a row from this null query only if it is not being returned from the other query.
    I know confusing but...:-(

    I am all set. Added something in where condition. Work around that would work:)

Maybe you are looking for

  • Problem in continuous Material Label Printing

    Hi Experts,           I am using SAP Script for Material Label Printing and Dot-matirx printer for printing.           There are 6 labels getting printed on a Page. There is no problem in printing but what happens,           whenever there is a new m

  • Crop image in Photoshop Elements 9

    how do i crop a photo to these dimensions 1500 X 1500 -could someone please help? It's Version Photoshop Elements 9 - (I don't know if they are asking me to crop 1500 mm or Pixels) could you help with both ?

  • Parallels window not displaying in Lion

    I installed lion fine.  When I try to open Parallels, it seems to open but no window shows up.  I hear the Windows sign-in sound but I cannot see it.  It just seems like the window is there, but I can not find it.  Any ideas?  I updated Parallels to

  • HP DeskJet and OS 9

    Okay, so I bought an HP DeskJet 5940xi. I use an older version of Word that runs in OS 9. But the DeskJet will not work under OS 9. I did a search and saw a reference to using the Printer Utility to trick the HP into running as Laser 8. Will this wor

  • Crossed out symbol instead of an apple during start up

    Start ups have been getting slower and slower for me and now I can't even get past the white screen. I now have a crossed out symbol instead of an apple during start up and the wheel is just spinning. I tried to start it up in safe mode and this is w