Group by clause will try to group the primay key's

hi all,
For my requiremments and to avoid the the subquery i am using join and group by clause in my sql query in oracle 10g r2 database.my question is if i put a primary column the group clause then oracle try to group the records?.
i know if we use a primary key column in group by clause there is no grouping will occur.
but i have doubt oracle will try to group ? because it will take some amount of time to achive?
else due presense of primay key column in group by clause oracle won't try?
Please advice ??

My query return the records less then the min v_date(date datatype) column.
i check this condition in having clause
my old query is
select emp_id,emp_name,voldate,volume,productivity
from volume v1
where v1.voldate<=(select min(v2.voldate) form volume v2 where v2.emp_id=1)
and v1.emp_id=1
i change it as
select emp_id,emp_name,voldate,volume,productivity
from volume v1,volume v2
where v1.emp_id=v2.emp_id
having v1.voldate<=min(v2. voldate)
group by emp_id,emp_name,voldate,volume,productivity
above the query's emp_id is primay key for volume table
comparing both query's which one is the best while looking th response time.
else any other alternative for both the queries.??

Similar Messages

  • I am having troubles, when I open LR I get a message that there is an error and it will try to fix the error next time it opens, but I get the error next time it opens, and this is going on and on where I can not use LR, any suggestions?

    I am having troubles, when I open LR I get a message that there is an error and it will try to fix the error next time it opens. LR closes on it's own, I reopen it and get that same message next time it opens, and this is going on and on where I can not use LR, any suggestions? If I click on a different set of photos in the libary before I get that message I might or might not get the message next time it oipens, but I still can not get to those photos, and it is not just one or two but most of my photos. HELP!!!!
    Thanks
    Carol

    The first thing I would suggest is for you to go to the folder containing your catalog, using your system browser. There will be a folder that has the extension .lrdata. Delete that folder, and then try to start Lightroom. If that doesn't work, replace your catalog with your most recent backup.

  • HT1883 I am trying to run a hardware test. The Computer will not start with the "D" key held?

    I am trying to run a hardware test. The Computer will not start with the "D" key held?

    If you are using a Blutooth keyboard, don't hold the "D" key until the keyboard is recognised (green light)
    Running AHT in Lion
    http://support.apple.com/kb/PH4510

  • HT201317 MY ICLOUD STOPPED WORKING ON MY LAPTOP. MESSAGE SAYS IT HAS STOPPED WORKING AND MICROSOFT WILL TRY TO FIX THE PROBLEM. WHAT SHOULD I DO?

    icloud has worked perfectly. now a message comes up saying" it has stopped working and microsoft will attempt to fix the problem". I have signed out and signed back in. restarted the computer. no luck. Any ideas?

    First thing I would try would be to remove the battery from your MacBook, connect the computer to it's power adapter and start up, then see if the keyboard and trackpad work normally. Some older batteries have been known to expand and interfere with keyboard and trackpad. If this works, replace the battery.
    Best of luck.

  • Using firefox 5 - when ever I try to use the same key more than once in a row, it does not work. Hitting the multiple times does nothing at all. How can this be corrected. HELP!!!

    everything that needs to be done on the keyboard is effected - letters, numbers, backspace, directionals, delete, home, end, page up, page down, '''all keys that are pressed more than once''' It does not matter what webpage I am on.
    PLEASE HELP
    this is very frustrating

    You may have switched on an accessibility feature called FilterKeys by keeping the Shift key pressed for too long.
    * http://www.microsoft.com/enable/products/windowsxp/default.aspx
    *http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/access_filterkeys_turnon.mspx?mfr=true

  • When adding bookmarks and trying to changing its name, Firefox won't allow using the mouse; Firefox will only allow using the arrow keys (MAC OS 10.5, Firefox 3.6.8)

    When adding a bookmark sometimes the web page name is too long. I used to be able to use my mouse, highlight the letters/words that I don't want, then use delete to truncate the desired bookmark name. Since the latest update/upgrade, Firefox won't let me use the mouse to click anywhere in the popup box. I can only use the arrow keys and the delete key.
    Nothing other than updates (using Mac Software Update and Firefox Update) has been done to this computer (it's a 2002 Power Mac G4-Dual 1.25GHz).

    When adding a bookmark sometimes the web page name is too long. I used to be able to use my mouse, highlight the letters/words that I don't want, then use delete to truncate the desired bookmark name. Since the latest update/upgrade, Firefox won't let me use the mouse to click anywhere in the popup box. I can only use the arrow keys and the delete key.
    Nothing other than updates (using Mac Software Update and Firefox Update) has been done to this computer (it's a 2002 Power Mac G4-Dual 1.25GHz).

  • Closing one window (x in top right corner) will try to close the second window as well.

    If I have two different windows open with tabs, and I try to close 1 window (no tabs), it will also try to close down the second window and ALL the tabs it contains as well. This has never happened in previous versions.
    But when I use the shortcut control w, the window closes fine.

    See "Hang at exit":
    * http://kb.mozillazine.org/Firefox_hangs
    * [[Firefox hangs]]

  • Why is it when I use my Ipod when ever I touch it I can't get it to work. I will try to unlock the screen but it takes me like 10 tries before I can gert it to unlock?

    When my ipod screen was craked I sent it to get fixed but after I got it sent back the callabirtion or sometenhing has been off. I haven't been able to shut off my ipod becasue it won't work. I try to use an app and my ipod will start clicking in diffrent appa and what not? Can  you please tell me whats the problem.

    From your description and history it appear there is a hardware problem with the iPod. To me the place did not do a satisfactory job and then should fix it at no cost (except maybe for shipping)

  • Hi, I have a mac mini..all of a sudden when I wake it up in the morning it says I didn't disconnect y external properly and it will try to retrieve the information..it finally appearsbut it never used to say I should disconnect the external before...help

    Hello, my mac mini has suddenly started displaying a warning sign when I wake it up..saying I didn't properly "eject" a device... It is referring to my external/backup hd {on which I store music files, photos, back up files, etc}.  It has never happened until yesterday... and I have had the hd hooked up for over a year.  Each night I just put my mini to sleep and when it wakes in the morning everything is fine... the only time I ever disconnect the external hd is when I completely shut down or unplug...the procedure then has been to turn off the mini...then disconnect the external hd and unplug it. This has always worked fine, then suddenly it says I haven't properly disconnected the external hd... I don't know what to do... am I supposed to use the eject button now before I shut down...and how can I do that... it will state that it is not able to be ejected because it is in use {the rotating photos in my monitor background are stored on the external hd}.  I am puzzled... don't want to lose the info on my external hd...but I need to be able to put my mini to sleep. Help, please.

    Have the pics allways been used off the external drive?
    Open Console in Utilities & see if there are any clues or repeating messages when this happens.
    Is Spotlight indexing that drive, or is it used by Time Machine?

  • B&H in NYC still selling CS6 Extended for students.  Is this legit? Will Adobe still provide the license keys for download?

    If I purchase Photoshop CS6 Extended (student edition) from B&H website, will I receive the Adobe license keys? I tried this at another university bookstore locally and could not make this work.  Got the impression Adobe is no longer providing keys to download this package.  Help please.

    Sounds legit.
    Adobe still sells it
    Creative Suite 6

  • Aggregate fuction with group by clause

    Hello,
    Following is assignment is given but i dont get correct output 
    so please i am request to all of us write code to solve my problem.
    There can be multiple records for one customer in VBAK tables with different combinations.
    Considering that we do not need details of each sales order,
    use Aggregate functions with GROUP BY clause in SELECT to read the fields.
    <garbled code removed>
    Moderator Message: Please paste the relevant portions of the code
    Edited by: Suhas Saha on Nov 18, 2011 1:48 PM

    So if you need not want all the repeated records, then you select all the values to an Internal table,
    and declare an internal table of same type and Usee COLLECT
    for ex:
    itab1 type  <xxxx>.
    wa_itba like line of itab1.
    itab2 type  <xxxx>. "<-This should be same type of above.
    select * from ..... into table itab1.
    and now...
    loop at itab1 into wa_itab.
    collect wa_itab1 into itab2.
    endloop.
    then you will get your desired result..

  • Output not sorted when using group by clause

    Recently we migrated our application from Forms5 to Forms10g and database from 7.3.2 to 10gR2.
    More than 400 applications using sql stmt with "group by" clause and without "order by".
    In Earlier version of oracle 7.3.2 "group by" clause in SQL stmt sorts the output by order of the column in the "group by"
    stmt, where new version of oracle 10g (10.2.0.1.0 - 64bit Production) doesnt behave like older version.
    eg select div_cd,dept_cd,count(*) from class group by div_cd,dept_cd
    Output of the above query in Oracle7
    DIV_CD DEPT_CD COUNT(*)
    0 1     120
    0 9 131
    1 4 938
    1 6 1
    4 1 1490
    5 2 59
    6 6 848
    6 9 295
    8 1 45
    9 5 19
    Output of same query in Oracle10g
    DIV_CD DEPT_CD COUNT(*)
    0 6 120
    0 9 131
    4 1 1490
    6 9 295
    8 1 45
    9 5 19
    1 4 938
    1 6 1
    5 2 59
    6 6 848
    My question is
    a) Does the oracle behave in that manner?.
    b) if so, Any patch set available for this?
    c) if no patch set how to resolve this issue.
    if i use "order by" clause
    along with group by then i can get the output how i want.
    BUt problem is more than 400 applications (forms) using above method.
    Identify Forms/Reports and rectifing is a tedious job.
    Anyone can give me a good solution to solve the above issue

    Group By does not, and never has guaranteed order. Just because it happened that way on the past does not mean it will continue to do so.
    In the past, the algorithm used for Group By invoked a sort. It was convenient for the system to simply dump the output in that resulting order. These days, Group By could also be accomplished using a hash algorithm. Walking through the hash can easily result in a completely different ordering, as you have seen.
    Your problem is that the assumptions made previously are now invalid. Oracle is still working correctly. No patch, but you might be able to work around it by crippling your database and using the COMPATIBLE parameter (although the official lower limit is 9.2.0)

  • Conditional GROUP BY clause

    Hi,
    I have four columns in group by clause. I want to add conditional group by clause.
    Case 1 : If one of the  column's value is null, I don't want to include it in group by clause. Means, Now GROUP BY clause will have only 3 columns.
    Case 2 : If not null, then GROUP BY clause with all four columns.
    Please help me out on this.
    Thanks in advance.  

    Hi
    I think it won't matter, all group functions by default ignore NULLs so your result won't differ.
    select  dept, loc, sum(sal)
    from (
    select 'A' emp , 1 dept , 'P' loc , 100 sal from dual union all
    select'B',1,'P',200 from dual union all
    select'C',2,'P',300 from dual union all
    select'D',2,'P',400 from dual union all
    select'E',3, 'P',500 from dual union all
    select'F',3, 'P',600 from dual union all
    select'G',4, 'Q',700 from dual union all
    select'H', null,'Q' , 1000 from dual union all
    select'I',null ,'Q', 2000 from dual union all
    select 'J' ,null, 'Q',300 from dual)
    group by dept,loc;
    Output
    DEPT      LOC      SUM(SAL)
    1                P      300
    2                P      700
    3                P      1100
                    Q      3300
    4                Q      700
    Now by doing grouping only for NOT NULL values,
    select dept,loc, sum(sal)
    from (
    select 'A' emp , 1 dept , 'P' loc , 100 sal from dual union all
    select'B',1,'P',200 from dual union all
    select'C',2,'P',300 from dual union all
    select'D',2,'P',400 from dual union all
    select'E',3, 'P',500 from dual union all
    select'F',3, 'P',600 from dual union all
    select'G',4, 'Q',700 from dual union all
    select'H', null,'Q' , 1000 from dual union all
    select'I',null ,'Q', 2000 from dual union all
    select 'J' ,null, 'Q',300 from dual)
    where dept is not null          --------------NOT NULL Condition
    group by dept, loc;
    Output
    DEPT     LOC      SUM(SAL)
    1           P           300
    2           P           700
    3           P           1100
    4           Q           700
    Now by doing grouping only for NULL values,
    select dept,loc, sum(sal)
    from (
    select 'A' emp , 1 dept , 'P' loc , 100 sal from dual union all
    select'B',1,'P',200 from dual union all
    select'C',2,'P',300 from dual union all
    select'D',2,'P',400 from dual union all
    select'E',3, 'P',500 from dual union all
    select'F',3, 'P',600 from dual union all
    select'G',4, 'Q',700 from dual union all
    select'H', null,'Q' , 1000 from dual union all
    select'I',null ,'Q', 2000 from dual union all
    select 'J' ,null, 'Q',300 from dual)
    where dept is null               --------------NULL Condition
    group by dept, loc;
    Output
    DEPT      LOC         SUM(SAL)
                    Q           3300
    The output is same for both the conditions.

  • -- SQL -- GROUP BY clause: non-aggregate fields mandate

    Hello,
    I was studying Databases, (particularly the retrieval of the data), and found something interesting.
    While using an Aggregate Function in the SELECT clause, it is mandatory to have all the non-aggregate fields in the SELECT clause to be there in the GROUP BY clause.
    For example,
    SELECT dept_no, SUM(salary)
    FROM employee
    GROUP BY dept_no;
    The above SQL works fine.
    But, what if the user misses the dept_no in the GROUP BY clause or he/she misses the GROUP BY clause itself?
    Certainly, it is an error.
    Why is this error not handled by the database. I mean, the database should be smart/intelligent enough to add the GROUP BY clause by itself. So suppose, if I miss out the GROUP BY clause or miss a non-aggregate field from the SELECT clause when I am having at least one aggregate function on a field with at least one non-aggregated field in the SELECT clause, the database should check the GROUP BY clause at time of compilation and add the mandate missed out fields in the GROUP BY clause.
    Example,
    SQL1:_
    SELECT dept_no, SUM(salary)
    FROM employee
    GROUP BY dept_no;
    SQL2:_
    SELECT dept_no, SUM(salary)
    FROM employee;
    Here, the SQL1 and SQL2, both should give me same outputs without an error.
    I am unable to understand why is this not handled?

    Hi,
    998478 wrote:
    ... If we mix aggregate and non-aggregate values then there must be a GROUP BY clause containing all the non-aggregate values. Why is this not handled by the database/compiler itself? It IS handled by the compiler itself. The compiler handles it by raising an error. The compiler has no way of knowing whether you want to remove something from the SELECT clause, or to add something to the GROUP BY clause, or not to use aggregate functions, or to use more aggregate functions, or some combination of the above. If the compiler re-wrote your code, and did any of these things automatically, it would be wrong more often than it was right, and you would (rightly) be complaining about its behavior.
    For example, this is clearly wrong:
    SELECT    deptno
    ,       job
    ,       SUM (sal)
    FROM       scott.emp
    GROUP BY  deptno
    ;What is the right way to fix it?
    <h3>1. Remove something from the SELECT clause</h3>
    SELECT    deptno
    ,       SUM (sal)
    FROM       scott.emp
    GROUP BY  deptno
    ;<h3>2. Add something to the GROUP BY clause</h3>
    SELECT    deptno
    ,       job
    ,       SUM (sal)
    FROM       scott.emp
    GROUP BY  deptno
    ,         job
    ;<h3>3. Not use aggregate functions</h3>
    SELECT    deptno
    ,       job
    ,       sal
    FROM       scott.emp
    ;<h3>4. Use more aggregate functions</h3>
    SELECT    deptno
    ,       MIN (job)
    ,       SUM (sal)
    FROM       scott.emp
    GROUP BY  deptno
    ;These aren't all the options, either. For example, the correct fix might be to use analytic functions instead of aggregate functions.
    How can anybody say which of these is right? All of them are the right answer for some problem.
    By the way, saying that everying in the SELECT clause must be an aggregate or in the GROUP BY clause is a bit over-simplified.
    More completely, here are the ABC's of GROUP BY:
    When you use a GROUP BY clause and/or an aggregate function, then everything in the SELECT clause must be:
    (A) an <b>A</b>ggregate function,
    (B) one of the "group <b>B</b>y" expressions,
    (C) a <b>C</b>onstant, or
    (D) something that <b>D</b>epends entirely on the above. (For example, if you "GROUP BY TRUNC(dt)", you can SELECT "TO_CHAR (TRUNC(dt), 'Mon-DD')").
    Edited by: Frank Kulash on Apr 13, 2013 1:44 PM
    Added code examples.

  • Removing an attribute from a group by clause

    This concerns a web application developed by JDeveloper 10.1.2 (adf, uix). I have viewobject with a query, written in expert mode, that has a group by clause. I removed an attribute from the select statement that was included in the group by clause and removed it from the bindings of the page that displays the data from the view. When I test the application module the data is grouped correctly. But when I run the view the attribute is not shown on the page but the data is still grouped by the attribute. The same query works fine in SQL plus, it looks like JDeveloper 'remembers' the old group by clause somewhere. I checked the xml file of the view object and it looks ok. Where can the old group by clause be written? How comes it is still applied?

    joni1129 wrote:
    I am trying to place a shape on an image and remove it from the photo, creating just the picture within the shape.  When I follow instructions, I get a lovely shape around my image, but the image isn't removed.  It just sits in a white-checkered background.
    How do I get rid of the white background?
    The white-checkered background is a visual reference for transparency. (It won't print.) To keep the transparency, you need to save in a format that supports transparency, PSD, TIF (with save transparency checked), PNG, or GiF. If you save in a format such as JPG that doesn't support transparency, the transparency is replaced by white.
    Edit: If you are transferring the image into another software application, you may have to save the selection along with the image. Select<Save Selection. You'd have to also check which of the formats that application accepts.

Maybe you are looking for