VB: Simple Selection

Hi all,
I am just writing my first Photoshop CS2 script in VB that exports all layers to separate files, where the resulting file resolutions are the same as the layer bounds.
So far no problem.
The way I thought about is
- Opening Document
- running on all Layers
- making a Selection of Layer-Size
- Copy this Selection
- New File, paste, Save
- next Layer
I'm sticking in making a selection. Didn't manage to build the correct syntax for selecting the layer bounds I got by layer.Bounds.
The current code is:
document.Selection.Select(layer.Bounds, Photoshop.PsSelectionType.psReplaceSelection, 0, False)
Unfortunately this throws an error. What am I doing wrong?

Finally directly after writing this thread I found it ;)
Dim x1 As Integer = layer.Bounds(0)
Dim y1 As Integer = layer.Bounds(1)
Dim x2 As Integer = layer.Bounds(2)
Dim y2 As Integer = layer.Bounds(3)
'Dim selectionBounds(,) As Integer = New Integer(3, 1) {{x1, y1}, {x2, y1}, {x2, y2}, {x1, y2}}
Dim selectionBounds() As Object = New Object() {New Object() {x1, y1}, New Object() {x2, y1}, New Object() {x2, y2}, New Object() {x1, y2}}
document.Selection.Select(selectionBounds, Photoshop.PsSelectionType.psReplaceSelection, 0, False)

Similar Messages

  • Simple Select statement in MS Access

    I am not able to get this simple select statement working in MS Access.
    "SELECT PhotoLocation from RfidData WHERE TeamID = '"+teamID ;
    It is using a variable called teamID which is a string.
    The error is java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression
    Please Suggest
    Thank You...

    Let's look at your code, shall we?
    public String readPhotoLoc(String teamID)
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        Connection con = DriverManager.getConnection(dbURL,"","");
        PreparedStatement ps = con.prepareStatement("Select PhotoLocation from RfidData ");  // There's no bind parameter here, so setString will do nothing
    ps.setString(1,teamID);
    ResultSet rs = ps.executeQuery();  // what do you do with the ResultSet?  Nothing.  //You don't return anything,  either.  I doubt that this mess even compiles.
    }Here's one suggestion for how to write it properly:
    public String readPhotoLoc(Connection connection, String teamID)
        String photoLoc = null;
         PreparedStatement ps = null;
         ResultSet rs = null;
        try
            String query = "SELECT PhotoLocation FROM RfidData WHERE TeamID = ?";
            ps = connection.prepareStatement(query);
            ps.setString(1,teamID);
            rs = ps.executeQuery();
            while (rs.next())
                photoLoc = rs.getString("PhotoLocation");
            return photoLoc;
        catch (SQLException e)
              e.printStackTrace();
               return null;
        finally
              try { if (rs != null) rs.close(); } catch (SQLException ignoreOrLogThis) {}
              try { if (ps != null) ps.close(); } catch (SQLException ignoreOrLogThis) {}
    }Make sure that the types of the columns match the Java types.
    %

  • Simple Select on VBPA using index running very slow

    Hello,
    We have a very simple selection on the table VBPA:
    data:
    begin of it_vbeln occurs 100,
      vbeln like vbpa-vbeln,
    end of it_vbeln.
    select vbeln from vbpa
    into table it_vbeln
    where
    kunnr = '##########'
    and parvw = 'AG'.
    All we're trying to accomplish is to find orders for a given customer number and type.
    We have two indices "Z1" and "Z2" which respectively declare: KUNNR, and MANDT, KUNNR, PARVW.
    In looking at a sql trace, it says it's using the VBPA~Z2 index, which is expected, and that its estimated costs are very low on the index:
    SELECT STATEMENT ( Estimated Costs = 71 , Estimated #Rows = 63 )
           2 TABLE ACCESS BY INDEX ROWID VBPA
             ( Estim. Costs = 71 , Estim. #Rows = 63 )
             Estim. CPU-Costs = 553,782 Estim. IO-Costs = 71
               1 INDEX RANGE SCAN VBPA~Z2
                 ( Estim. Costs = 3 , Estim. #Rows = 111 )
                 Search Columns: 3
                 Estim. CPU-Costs = 43,764 Estim. IO-Costs = 3
    Despite declaring that it will do an index range scan, in SM51 it shows as Sequential Read (Table Scan?) and takes a VERY long time to return, about 60 - 120 seconds.
    Since this is needed for a user exit that will be run during order creation, it needs to occur MUCH faster. Our entries in VBPA number above 10 million records currently.
    Can anyone suggest either why the index does not appear to be helping (it takes just as long without the index), or perhaps another method for finding the orders for a given customer number.
    Thank you,
    Randy

    Hi Randy,
    I suggest you skip the attempts to speed up selecting on VBPA, but rather look into using table VAKPA for finding sales documents for a given partner number.
    Greetings
    Thomas

  • Simple select query is taking a lot of time

    hi gems...
    my table has 7267563 rows...and i am doing a simple select * from table;
    but it is taking a lot of time nearly 25minutes but not completed...
    when i did select count(1) from table then it gave the result instantly also select * from table where rownum < 10 is also fine...even when i am selecting all the records using rownum i.e. select * from table where rownum < 7267563 is also giving result instantly...
    but the entire table is not getting result i.e. select * from table...also there is no lock in the table(though i know that select is nothing to do with lock)..
    what may be the issue..please suggest...thanks in advance...
    Edited by: user12780416 on Dec 12, 2011 11:08 PM

    Hi;
    Please see below thread
    query takes too long ...
    help in solving long run query
    HOW TO: Post a SQL statement tuning request - template posting
    Hope it helps
    Regard
    Helios

  • A simple select query taking forever

    Hi All
    I am not able to execute a simple select query, I traced my session and here is TKPROF of that Trace.
    Solaris 8 , Oracle 10.2.0.4.0
    TKPROF: Release 10.2.0.4.0 -
    Copyright (c) 1982, 2007, Oracle.  All rights reserved.
    Trace file: 502_ora_28260.trc
    Sort options: default
    count    = number of times OCI procedure was executed
    cpu      = cpu time in seconds executing
    elapsed  = elapsed time in seconds executing
    disk     = number of physical reads of buffers from disk
    query    = number of buffers gotten for consistent read
    current  = number of buffers gotten in current mode (usually for update)
    rows     = number of rows processed by the fetch or execute call
    select OBJECT_ID , ORACLE_USERNAME , SESSION_ID
    from
      v$locked_object
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        1      0.03      32.86          0          0          6           0
    total        3      0.03      32.86          0          0          6           0
    Misses in library cache during parse: 1
    Optimizer mode: CHOOSE
    Parsing user id: SYS
    Rows     Row Source Operation
          0  MERGE JOIN  (cr=0 pr=0 pw=0 time=60 us)
          0   SORT JOIN (cr=0 pr=0 pw=0 time=58 us)
          0    MERGE JOIN  (cr=0 pr=0 pw=0 time=42 us)
          1     SORT JOIN (cr=0 pr=0 pw=0 time=2443 us)
       1105      FIXED TABLE FULL X$KSUSE (cr=0 pr=0 pw=0 time=1204 us)
          0     SORT JOIN (cr=0 pr=0 pw=0 time=41 us)
       1001      FIXED TABLE FULL X$KTCXB (cr=0 pr=0 pw=0 time=16132 us)
          0   SORT JOIN (cr=0 pr=0 pw=0 time=0 us)
          0    FIXED TABLE FULL X$KTADM (cr=0 pr=0 pw=0 time=0 us)
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      SQL*Net message to client                       1        0.00          0.00
      buffer busy waits                              34        0.97         32.83
      SQL*Net break/reset to client                   1        0.00          0.00
    OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        1      0.03      32.86          0          0          6           0
    total        3      0.03      32.86          0          0          6           0
    Misses in library cache during parse: 1
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      SQL*Net message to client                       2        0.00          0.00
      SQL*Net message from client                     1       19.00         19.00
      buffer busy waits                              34        0.97         32.83
      SQL*Net break/reset to client                   1        0.00          0.00
    OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute      0      0.00       0.00          0          0          0           0
    Fetch        0      0.00       0.00          0          0          0           0
    total        0      0.00       0.00          0          0          0           0
    Misses in library cache during parse: 0
        1  user  SQL statements in session.
        0  internal SQL statements in session.
        1  SQL statements in session.
    Trace file: 502_ora_28260.trc
    Trace file compatibility: 10.01.00
    Sort options: default
           0  session in tracefile.
           1  user  SQL statements in trace file.
           0  internal SQL statements in trace file.
           1  SQL statements in trace file.
           1  unique SQL statements in trace file.
          64  lines in trace file.
          32  elapsed seconds in trace file. There is nothing fishy in alert logs... Please guide
    Thanks

    There it is TOP
    $ RUMPSHAKER>top
    load averages:  6.63,  7.45,  7.88;                    up 33+12:02:33           
    3631 processes: 3616 sleeping, 5 zombie, 1 stopped, 9 on cpu
    CPU states: 58.6% idle, 18.2% user, 23.2% kernel,  0.0% iowait,  0.0% swap
    Memory: 192G phys mem, 92G free mem, 96G swap, 96G free swap
       PID USERNAME LWP PRI NICE  SIZE   RES STATE    TIME    CPU COMMAND
    13752 ora0005    1  19    0 4243M 4219M sleep    5:21 62.78% oracle
    17758 ora0005    1  25    0 1174M 1156M cpu      1:05 37.12% oracle
    17923 root       1  57    0   18M   14M sleep  689:07 13.59% ecap_monitor
    20777 root      12  58    0   14M   13M sleep  864:33 11.55% OracleAgent
    18884 ora0004    1   1    0  830M  813M sleep    0:01  9.54% oracle
    12070 ora0004   61  58    0  320M  315M sleep   28.5H  8.29% emagent
    20347 root      16  59    0   33M   25M sleep   26.0H  6.34% caiUxsA2
    17949 ist0005    1  53    0 7984K 4984K cpu      0:00  3.93% top
         1 root       1  59    0 2912K 1288K sleep   32.2H  3.75% init
    15035 ora0001    1  46    0   32M   22M sleep  166:43  2.98% tnslsnr
      5748 ora0004   11  54    0  516M  496M sleep  389:37  2.78% oracle
    20567 ora0004    1  55    0   27M   22M sleep    0:00  2.69% sqlplus
      6730 ora0001    1  33    0  632M  616M sleep    0:06  2.67% oracle
    20557 ora0004    1  56    0   27M   23M sleep    0:00  2.53% sqlplus
      5355 ora0005    1  59    0 1154M 1137M sleep    0:04  2.46% oracleand VMSTAT 2 5
    $ RUMPSHAKER> vmstat 2 5
    kthr      memory            page            disk          faults      cpu
    r b w   swap  free  re  mf pi po fr de sr s0 s1 s2 sd   in   sy   cs us sy id
    6 8 0 143125576 74272080 4628 24012 488 150 149 0 0 4 4 -2 0 25037 192698 65249 38 26 36
    1 3 0 162803992 95246464 1989 6989 0 4 4 0 0 6 6 0  0 9170 57822 26434 8 13 79
    1 7 0 162801352 95240296 3043 15633 4 9737 9682 0 0 0 0 0 0 11277 73516 38200 16 16 68
    3 10 0 162801560 95227920 3326 12729 16 16862 16774 0 0 1 1 0 0 11377 86054 44758 16 17 68
    1 10 0 162784520 95186488 9638 48359 24 11682 11626 0 0 13 13 0 0 13484 149366 44205 23 29 47

  • Problem with SImple Select Query

    Hi
    I am trying to write a simple Select SQL to a table and find out whether certain data exist or not. I have done this before but now for some reason this one is not working.
    I started like this
    select single * from ANLH where ANLN1 = rec-Asset
                                                 and BUKRS = Comp_Cd.
    * Error Handler for non-existent empno in the database
      if sy-subrc = 0 or rec-asset = ''.
         rec_failed = 'T'.
         concatenate 'Asset does not exist' rec-asset into asst_err.
      endif.
    when i debugged the code i found out that sy-subrc  is returning 4 all the time. (i have passes some numbers in rec-Asset which i know doesn't exist in that table.
    So i have modified the code to see if its pulling anything.
    like this
    select single ANLN1 into v_Asset from ANLH where ANLN1 = rec-Asset
                                                 and BUKRS = Comp_Cd.
    * Error Handler for non-existent empno in the database
      if sy-subrc = 0 or rec-asset = ''.
         rec_failed = 'T'.
         concatenate 'Asset does not exist' rec-asset into asst_err.
      endif.
    in debug v_asset is always empty (for real number and for the madeup number)
    Please help.
    Thanks
    Edited by: Anwarul Kabir on Apr 3, 2008 9:27 PM
    Edited by: Anwarul Kabir on Apr 3, 2008 9:29 PM
    Edited by: Anwarul Kabir on Apr 3, 2008 9:30 PM

    Thanks for the answer. But i thought i was doing the same. Anyway I replaced my code with yours but result is the same. I also did this
    select single
    ANLN1 into v_Asset
    from ANLH where
    ANLN1 = '20000544'
    and BUKRS = '3000'.
    I did SE11 and entered the table name and i can see that data.
    but on my code i get sy-subrc=4 and v_Asset is blank
    again i tried with this madeup number which i know its not in the table
    select single
    ANLN1 into v_Asset
    from ANLH where
    ANLN1 = '2056555433544'
    and BUKRS = '3000'.
    Get sy-subrc=4 and v_Asset is blank...
    Is there anything special about the Table?

  • Simple Select Query Taking 5-10s

    We have a web server on the same lan as the DB server.
    A simple select * from tablename (~100 entries) is taking
    anywhere from 30ms to 10 seconds lan. ASP code on the web server
    provides instant (30ms) queries. Ping is never <1ms. If I point
    to a remote DB server, the same query is never more than 300ms
    (which is great for over the internet).
    I enabled logging in CFAdmin -> Datasources and shortly
    after my select * from tablename I see this:
    spy(2009/02/28 16:39:00.539)>>
    Connection[2].setReadOnly(boolean readOnly)
    spy(2009/02/28 16:39:00.539)>> readOnly = false
    spy(2009/02/28 16:39:00.539)>> OK
    spy(2009/02/28 16:39:05.726)>> OK (true)
    We need to get this up and running ASAP. Please help!!

    > I'm connecting to SQL Server 2000 on a Win2k3 box.
    > The default CF8 Installation.
    > Every table this happens for.
    OK. I think CF8 runs the most recent JDBC drivers too. It
    might pay to
    check that though.
    > Select * is needed, because we have existing sites we
    are migrating a lot of
    > which use select *.
    Sure. But just for the purposes of experimentation, change
    your test code
    to specify columns to see if it makes any difference.
    It might pay to get hold of FusionReactor to check what CF is
    doing with
    the queries, under the hood.
    Adam

  • Swap Counter in simple Selection Sort method

        void sortSelection(List object)
             int swapCount=0;
               for(int i = list.length; i >= 2; i--)
                 int maxIndex = 0;
                        for(int j = 1; j < i; j++)
                             if(list[j] > list[maxIndex])
                                  maxIndex = j;
                   int temp = list[maxIndex];        //
                   list[maxIndex] = list[i-1];         //         Is the problem here?        
                   list[i-1] = temp;                     //
                   swapCount++;                     //
              System.out.println("\n" +swapCount+ " swaps were needed. ");
        }This is a pretty simple selection sort method. But I am fairly sure that I am incorrectly counting swaps with the code. I have defined a "swap" as when two array indices have their values switched. I am convinced that there is something wrong because the array of numbers is randomly generated, and yet the swapCount counter is always equal
    to (list.length-1) when it prints out. I would think it should be different every time. I indicated the line where I believe the problem lies, but I am not for sure. Thanks everybody.

    List of Random Integers, then sorted:
    9, 29, 30, 42, 53, 58, 59, 64, 66, 69, 74, 79, 79, 87, 95
    9 swaps were needed.then sort again (descending) and get this:
    95, 87, 79, 79, 74, 69, 66, 64, 59, 58, 53, 42, 30, 29, 9
    1 swaps were needed.I'm pretty sure that isn't correct. But forgive me if I did not specify that it was to work in descending order as well.
    So I tried this:
    void sortSelection(List object)
             int swapCount=0;
               for(int i = list.length; i >= 2; i--)
                 int maxIndex = 0;
                        for(int j = 1; j < i; j++)
                             if(list[j] > list[maxIndex])
                                  maxIndex = j;
                  if (maxIndex != (i-1) && ascending==true)
                       int temp = list[maxIndex];
                        list[maxIndex] = list[i-1];                             
                        list[i-1] = temp;   
                        swapCount++;
                  else if (maxIndex != (i+1) && descending==true)
                       int temp = list[maxIndex];
                        list[maxIndex] = list[i-1];                             
                        list[i-1] = temp;   
                        swapCount++;
    } adding the i+1 (because it is going in a different order)...and I think I solved it!

  • How to excecute simple select using EntityManager

    Hello I am developing a project using Seam, JSF, EJB and JBoss.
    All the mappings to the database are correctly done.
    However I would like to create a simple select that retrieves the maximum value of the id.
    This is how I thought I could do it.
    Query q = em.createNativeQuery("select max(id)", Project.class);
    But it keeps telling me that column id cannot be found.
    Am I writing something wrong?

    Ok, this is how I solved it.
    Query q = em.createQuery("select max(id) from " + Project.class.getName());
    Changed it to createQuery and class.getName

  • A simple selection of objects behind and much more

    Selecting things under a different object in the Illustartor is sometimes very annoying.
    For proper selection of objects was invented several tools. Please use them alternately depending on the situation.
    - outline mode
    - preferences = object selections by patch only
    - menu Lock = lock selection, All artwork above other layers
    + isloate mode
    + smart guides
    + layers (pity that to this day can not enable the option automatically locates the object)
    But still the selection of one object over time requires a lot of time and clicking. Especially if they are just above or below.
    The Blender is such a great option. According to me, works well and is easy to use. You can work on hundreds of superimposed objects, and continues to act quickly. it is not perfect but I would very I would see in Illustrtaor. However, this requires a better reflection of the current use of the objects in Illustrator than it is today.
    New Method of Selection:
    1. Click on an object once and you select an object on top,
    2. for any re-clicking LBM selects an object underneath. Simple, fast and understandable.
    +. By clicking and selecting objects at the same time watching a dream in which Appearance palette name and see what properties of the selected object.
    +. Adding to the selection or subtraction:
             - When I have selected the correct object can click on the layer name
              - Layer palette displays a view of all layers
              - New: Automatically expanding palette view to show the structure of the objectindicated in the structure of the layers and stack.
              - Now I can easily add or subtract to the selection of other objects or select just another object.
    Important to work with this method to modify the interface illustartor.
    1. Palette Appearance must expand and show more things. For example, as in this description:
        http://forums.adobe.com/message/3024803#3024803
    2. This rapid work with objects should also improve the Illustrator interface and make it more useful.
         Quick change opportunity to give a name or a group or object.
         Even now it is missing this opportunity. Even now it is missing this opportunity. For example, click and change the name in these views:
         One Clik and change name of layers or object or group or patch...
    Note. If it can be easily and quickly rename objects. RBM is an option on the menu will show that the category of the popup list of objects under the cursor.
      It would be enough to click on the object and would be selected. Super for me!
    3. New. The new functionality.
         - Appearance palette retains the settings of the object was last selected. Just as color palette ikon "Out of... Click to correct".
    The appearance palette, she could be named: "Last appearance use. Click to Add or Click+Alt to show".
         - This allows me to select a different object, and quickly give it the properties of the previous one.
         - Or click on the icon of the previous appearance when they are showing up and I choose only the one I want to use the new facility, eg by drag & drop the icon of the appearance of the currently selected object. — Something like a story last selected object appearance to choose to use the newfacility.
    Or better. Drop-down list to the history of recently used names of objects.
    The choice would result in giving the highlighted current object stored Apperance.Alt + Click does not change the selected object apperance just simply list Apperance with the possibility of drag and drop individual features in the current Apperance select object.
    Appearance to such a list could choose to display in the view layers palette by clicking on the icon Apperance.
    Of course, the idea presented is not conclusive, show just the way we work withillustartor expect from a modern program.
    After the present work in Illustartorze are really very complex and currentlydevotes much time on it just to check something.
    Currently Illustartor reminds me of a Christmas tree with different ideas than theprofessional tool for my daily earning.
    I spend my time like other colleagues on this forum because I support the idea, and Adobe Illustrator.
    I hope someone appreciates it. I've been looking around for an idea for anotherprogram to work with vectors.

    and...

  • Decimal places in a simple select query

    Hi , I've a very basic query for you. I'm running the Select statement below, and want the Area to be just two decimal places. Is there a simple way of doing this ?
    I'm having to compare the difference in accuracy between area calculations in Oracle Spatial and MapInfo to some very sceptical users, and they want to know if we're going to be getting 'vastly' different results.
    (The tolerance is set to 0.5 mm in this instance, as we're using Ordnance Survey MasterMap to derivve our spatial objects).
    select sssi_name, sdo_geom.sdo_area (geoloc, 0.0005)
    from SSSI
    Many Thanks,
    Bruce

    Do you mean simply the following?
    select
        sssi_name,
        round(sdo_geom.sdo_area(geoloc, 0.0005), 2)
    from SSSI

  • "System Resource Exceeded" for simple select query in Access 2013

    Using Access 2013 32-bit on a Windows Server 2008 R2 Enterprise. This computer has
    8 GB of RAM.
    I am getting:
    "System Resource Exceeded"  errors in two different databases
    for simple queries like:
    SELECT FROM .... GROUP BY ...
    UPDATE... SET ... WHERE ...
    I compacted the databases several times, no result. One database size is approx 1 GB, the other one is approx. 600 MB.
    I didn't have any problems in Office 2010
    so I had to revert to this version.
    Please advise.
    Regards,
    M.R.

    Hi Greg. I too am running Access on an RDP server. Checking Task Manager, I can see many copies of MSACCESS running in the process list, from all users on the server. We typically have 40-60 users on that server. I am only changing the Processor Affinity
    for MY copy, and only when I run into this problem. Restarting Access daily, I always get back to multi-processor mode soon thereafter.
    As this problem only seems to happen on very large Access table updates, and as there are only three of us performing those kind of updates, we have good control on who might want to change the affinity setting to solve this problem. However, I
    understand that in other environments this might not be a good solution. In my case, we have 16 processors on the server, so I always take #1, my co-worker here in the US always takes #2, etc. This works for us, and I am only describing it here in case it
    works for someone else.
    The big question in my mind is what multi-threading methods are employed by Microsoft for Access that would cause this problem for very large datasets. Processing time for an update query on, say, 2 million records is massively improved by going down
    to 1 processor. The problem is easily reproduced, and so far I have not seen it in Excel even when working with very large worksheets. Also have not seen it in MS SQL. It is just happening in Access.

  • Simple select query

    Hi,
    I'm using database version 10.2.0.4.0
    I have a simple table here that goes like this:
    customerPreference (customerid, fruitid)
    I want to find out which customerid had bought all the different fruits.
    I did a distinct count of fruitid, but how do I choose which customerid has that distinct count value?
    select count(distinct fruitid) AS total_number_of fruits
    from customerPreference;
    Regards,
    Keith

    >
    customerPreference (customerid, fruitid)
    I want to find out which customerid had bought all the different fruits.
    I did a distinct count of fruitid, but how do I choose which customerid has that distinct count value?
    select count(distinct fruitid) AS total_number_of fruits
    from customerPreference;
    >
    Well you got the first part done; the number of distinct fruits.
    So the next part is to get a list of customers and the number of distinct fruits each of them has purchased and then filter it using your query above. This is untested since you didn't provide table ddl or data.
    SELECT CUSTOMERID, COUNT(DISTINCT FRUITID) AS CUST_DISTINCT_FRUITS
    FROM CUSTOMERPREFERENCE
    GROUP BY CUSTOMERID
    HAVING COUNT(DISTINCT FRUITID) = (
    select count(distinct fruitid) AS total_number_of fruits
    from customerPreference);

  • Simple SELECT with a group by condition

    Hello guys
    How could I build a simple map based in the query below ?
    select ename, job, sal
    from emp
    where sal < (select avg(sal) from emp)
    What operators should I use ?
    Source -> Aggregator-> what else ... ?

    Thank you bwise. This helped me a lot.
    However, if you can yet help me, I'll be thankful
    My question is a little bit more complicated.
    I have 2 cursors in PL/SQL
    cursor c1 is
    select e.ename, d.dname, d.deptno
    from emp e, dept d
    where e.deptno = d.deptno;
    cursor2 c2 (p1 number) is
    select avg(salary) avg1
    from emp
    where deptno = p1;
    r1 c1%rowtype;
    r2 c2%rowtype;
    counter number(4):=0;
    begin
    counter := 0;
    open C1;
    loop
    fetch C1 into R1;
    exit when (C1%NOTFOUND);
    counter := counter + 1;
    open C2 (r1.deptno);
    fetch C2 into R2;
    update emp set dept_avg = r2.avg1
    where empno = r1.empno;
    more processing;
    end loop;
    end;
    Do you have any idea of how can implement this in a map ?
    Thank you
    Marcelo

  • How to optimize this select statement  its a simple select....

    how to optimize this select statement  as the records in earlier table is abt i million
    and this simplet select statement is not executing and taking lot of time
      SELECT  guid  
                    stcts      
      INTO table gt_corcts
      FROM   corcts
      FOR all entries in gt_mege
      WHERE  /sapsll/corcts~stcts = gt_mege-ctsex
      and /sapsll/corcts~guid_pobj = gt_Sagmeld-guid_pobj.
    regards
    Arora

    Hi Arora,
    Using Package size is very simple and you can avoid the time out and as well as the problem because of memory.  Some time if you have too many records in the internal table, then you will get a short dump called TSV_TNEW_PAGE_ALLOC_FAILED.
    Below is the sample code.
    DATA p_size = 50000
    SELECT field1 field2 field3
       INTO TABLE itab1 PACKAGE SIZE p_size
       FROM dtab
       WHERE <condition>
    Other logic or process on the internal table itab1
    FREE itab1.
    ENDSELECT.
    Here the only problem is you have to put the ENDSELECT.
    How it works
    In the first select it will select 50000 records ( or the p_size you gave).  That will be in the internal table itab1.
    In the second select it will clear the 50000 records already there and append next 50000 records from the database table.
    So care should be taken to do all the logic or process with in select and endselect.
    Some ABAP standards may not allow you to use select-endselect.  But this is the best way to handle huge data without short dumps and memory related problems. 
    I am using this approach.  My data is much more huge than yours.  At an average of atleast 5 millions records per select.
    Good luck and hope this help you.
    Regards,
    Kasthuri Rangan Srinivasan

  • Building a "simple" Select

    Hi,
    I know that the select I4m trying to make will be a piece of cake for the more experienced people in SQL and selects.
    I have 2 tables one with (nr_emp , Name , phone) and another with (code , nr_emp , etc).
    I want to get the rows from the first table that don4t have nr_emp on the second table.
    I think it4s simple too but all my atempts on constructing a Select to do it have failed, this is the select that i figured out: SELECT emp.nr_empregado FROM empregado emp , (select l.nr_empregado from login l) log where emp.nr_empregado != log.nr_empregado
    I know that it doesn4t work and understand why, but can4t find out another logic to make this work. Any ideas?

    Hello,
    Please start a new question, instead of adding to an existing thread.
    Listed below is your SELECT and one I made.
    -- Your SELECT
    SELECT  Cod_Processo
        ,   Nome_Processo
    FROM    PROCESSOS
    WHERE   Cod_Processo NOT IN
                (   (   SELECT  A.Cod_Processo
                        FROM    AUTORIZACAO A
                            ,   PERFIL_EMPREGADO PE
                        WHERE   PE.Nr_Empregado = $Codemp
                        AND     A.Cod_Perfil = PE.Cod_Perfil
                    OR
                    (   SELECT  PS.Cod_Processo
                        FROM    PROCESSOS_SUBTRAIDOS ps
                        WHERE   PS.Nr_Empregado = $Codemp
                    OR
                    (   SELECT  PA.Cod_Processo
                        FROM    PROCESSOS_ADICIONADOS PA
                        WHERE   PA.Nr_Empregado = $Codemp
    ORDER BY TO_NUMBER ( Cod_Processo ) ASC
    =====================
    You might try
    =====================
    SELECT  P.Cod_Processo
        ,   P.Nome_Processo
    FROM    PROCESSOS   P
    WHERE   NOT EXISTS
            (   SELECT  1
                FROM    AUTORIZACAO A
                    ,   PERFIL_EMPREGADO PE
                WHERE   PE.Nr_Empregado = $Codemp
                AND     A.Cod_Perfil    = PE.Cod_Perfil
                AND     A.Cod_Processo  = P.Cod_Processo   -- Link to main SELECT
    AND     NOT EXISTS
            (   SELECT  1
                FROM    PROCESSOS_SUBTRAIDOS ps
                WHERE   PS.Nr_Empregado = $Codemp
                AND     PS.Cod_Processo = P.Cod_Processo   -- Link to main SELECT
    AND     NOT EXISTS
            (   SELECT  1
                FROM    PROCESSOS_ADICIONADOS PA
                WHERE   PA.Nr_Empregado = $Codemp
                AND     PA.Cod_Processo = P.Cod_Processo   -- Link to main SELECT
    ORDER BY TO_NUMBER ( Cod_Processo ) ASCGood Luck,
    Eric Kamradt

Maybe you are looking for

  • HT2513 sync tasks in ical with reminders on the iphone

    How do I sync tasks in iCal with the reminders feature on my iPhone?

  • What is the best file format to work in, with PSE11

    For years I have been editing and saving my cartoons in JPEG format. They looked fine on my site and I was happy. But then uh-oh yesterday while perusing PSE Help I read that I should be editing and saving in Photoshop's own PSD format because saving

  • Postscript na HP LASERJET CP1525NW COLOR

    A minha impressora é uma HP Laserjet 1525nw color. Instalei o postscript na minha CP1525NW e as imagens impressas estão lindas!! Só que tem 3 problemas. 1- No Photoshop eu não consigo fazer a impressora imprimir (paisagem) horizontal, o papel segue v

  • 20" vs 23" for Macbook

    I have macbook and I am considering to buy either the 20" or the 23". I am not sure what resolution the video card will support so 23" may not be the best selection. What do y'all think? Any suggestions? Obviously there is the price difference but fo

  • Using Current iTunes Library With New Nano

    My daughter's iPod Mini seems to have played it's last song and a new 2G Nano is on it's way. Is there anything that I need to do that may not be printed in the manual to transfer her current iTunes library on our PC to the new Nano? We run Windows X