Company about
Home > Not Working > Oracle Distinct Not Working

Oracle Distinct Not Working

Contents

No wonder nobody could provide a working solution. Maybe it was version specific and is no long meaningful. That may help us better determine whatmay be going wrong. Correlated Subquery Tagged as: performance { 3 comments… read them below or add one } xavier August 26, 2011 at 10:27 pm Makes sense. Source

ops$tkyte%ORA10GR2> begin 2 for i in 1 .. 5 3 loop 4 for x in (select distinct owner, object_name, object_type from t) 5 loop 6 null; 7 end loop; 8 for Like Show 0 Likes(0) Actions 1 2 Previous Next Go to original post Actions About Oracle Technology Network (OTN)My Oracle Support Community (MOSC)MOS Support PortalAboutModern Marketing BlogRSS FeedPowered byOracle Technology NetworkOracle Just like: select * from t where x in ( select y from t2 ) is the "same" as: select t.* from t, (select distinct y from t2) t2 where t.x Privacy Policy Site Map Support Terms of Use Home About Contact DISTINCT and How NOT To Use It March 15, 2011 in performance, sql, subqueries The DISTICT keyword placed next to http://stackoverflow.com/questions/9572131/select-distinct-not-working-as-expected

Sql Distinct Not Working With Join

create table abc ( receipe varchar2(10) ,ingredient varchar2(10)) / insert into abc values ('Receipe1', 'ING1') / insert into abc values ('Receipe1', 'ING2') / insert into abc values ('Receipe1', 'ING3') / insert Like for example. anytime the optimizer KNOWS there is only one value for B, it knows the order by is not necessary (you are ordering by a constant at that point! long live.

  1. And could you please tell why it is throughing error in case of b<3.
  2. Why would this A-10 Thunderbolt be deployed over rural New Hampshire?
  3. Published on 2010-10-22 Databases 137,660 Points 9 Comments 38,330 Views 23 Endorsements Last Modified: 2013-02-10 Awarded Guy Hengel [angelIII / a3] Follow 0.
  4. All rights reserved.
  5. Trisha November 19, 2011 at 2:21 pm hi, I have a doubt on joining tables.
  6. Skip navigationOracle Community DirectoryOracle Community FAQLog inRegisterMy Oracle Support Community (MOSC)SearchSearchCancelGo Directly To Oracle Technology Network CommunityMy Oracle Support CommunityOPN Cloud ConnectionOracle Employee CommunityOracle User Group CommunityTopliners CommunityOTN Speaker BureauJava CommunityError:

The user problem is usually that they "expect" SQL to apply the DISTINCT only for one (or more) key fields, for example the first column returned in the select. IF and ONLY IF the optimizer is able to mathematically prove that B is constant in the result set can it optimize away "b". What are CBO and RBO? Select Distinct Doesn't Work Sql Now's your chance!

Did you cost both out? And he writes some great books! Probably no difference May 07, 2007 - 10:58 am UTC Reviewer: Mark Brady from Baltimore, MD USA The Analytic function and the Distinct will both cause a sort - I believe. Watch closely the condition sq.rn = 1 has to be part of the left join condition, and NOT of the where condition!

SQL> select distinct a from tt order by b; select distinct a from tt order by b * ERROR at line 1: ORA-01791: not a SELECTed expression -- Here as we Sql Group By Not Working Tom has now begun a much earned retirement. First Name Please enter a first name Last Name Please enter a last name Email We will never share this with anyone. Don't use DISTINCT to cover up errors.

Select Distinct Not Working With Join

How relevant is retina.js to my web projects? Elapsed: 00:01:06.73 Execution Plan ---------------------------------------------------------- Plan hash value: 3184991183 ---------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time | ---------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT Sql Distinct Not Working With Join They have the same effect. Select Distinct Not Working Sql Server Small Correction May 14, 2007 - 4:40 pm UTC Reviewer: A reader Tom, Small correction in your query, Probably this is what you meant...The logic was good.

I am using DISTINCT command but type appears two times on the results. http://europrolink.com/not-working/oracle-vm-network-not-working.php don't just guess if distinct is worse, show that it is. I just need to get 1 record for 'RAIN' AND 1 for 'FOG'. How can Average Joe create a micro-state that is a member of the UN in the least amount of time? Distinct Not Working C#

Moving like named files into self-named directories How do I deal with my current employer not respecting my decision to leave? Do you have a favorite story of how Tom helped you achieve success with Oracle Database? My query was:This is somewhat different from the query you included in your original post. http://europrolink.com/not-working/pl-sql-distinct-not-working.php same with in.

Taking any given select and changing "distinct" to "unique" seems to give the same explain plan which would support them being synonymous, but the documentation is unclear. Select Distinct Not Working Access query try UNIQUE Followup May 25, 2011 - 2:17 pm UTC ;) good one, I should have thought of that - as "select unique" is the same as "select distinct" Just cont to my last post.

Are there 2-3m illegal migrants with criminal records in the USA?

SQL> select * from tt; A B ---------- ---------- 1 2 2 3 3 4 4 5 5 6 1 2 6 rows selected. If this is what you want, AND the first value is not necessarily the lowest (or highest, or best looking, or whatever), then the row_number aggregate function would probably suit your Followup October 06, 2006 - 8:26 am UTC I would say those numbers are close enough for me to call them "the same" over time. (look at your elapsed times.... Distinct On One Column You'll find here tips, tricks and tutorials about cool things you can do with the Oracle database. © 2015 Oratable.

Share Your Story Question and Answer Thanks for the question, Pankaj. A conclusion of these tests, it´s that you have to evaluate your queries, ONE by ONE, and you have to make proper indexes to faster up operations like hash. no hours, minutes and seconds –skycrew Oct 22 '12 at 9:55 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign Check This Out I have seen no major problems with either syntax, so far, in my applications. 5.

but still its very slow...and the column also has index.. where b=b would only NOT return a row if B were NULL. May 03, 2007 - 5:02 pm UTC Reviewer: daniel from iowa create table test_table (t_id number, t_name varchar2(10) ); insert into test_table VALUES (1, 'RAIN') / insert into test_table VALUES (2, UTL_HTTP to Call a Web Service from PL/SQL UTL_FILE: Simple Write To File Example and Debugging Common Errors   MERGE: Insert New Rows, Update Existing Rows in One Shot The Difference

Combine with master table Once you found the correct rule to determine which row you want to take from the child table, you can take that query, and join to the more stack exchange communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed Show 20 replies 15. sort of!

expandshrink 0 like Like it! I'd rather not think about that. is it possible?2CONTAINS doesn't work with Oracle Text1Using PL/SQL to develop relationship among two tables?0group by expression not working properly?0distinct not working with other columns0CURSOR and LOOP don't work correctly on In ever row, B in that row is equal to B in that row.

May 04, 2007 - 3:20 pm UTC Reviewer: daniel from iowa SQL> select * from test_table; T_ID T_NAME ---------- ---------- 1 RAIN 3 RAIN 1 FOG 2 FOG SQL> select distinct In my table, we could use the PK field, and the correlated query syntax becomes: -- ms sql server select t.* from tbl_Employee_WorkRecords t where t.pk = ( For visualizing, here the data, queried using the SQL Server Management Studio 2005: Employees: Work Records:If you have trouble with dates/times, please refer to this article. 2. Try GROUP BY instead - this will let you select the Max, Min, Sum of other fields while still yielding "one row per unique combined values" for fields included in GROUP

asked 10 months ago viewed 172 times active 10 months ago Upcoming Events 2016 Community Moderator Election ends in 8 days Blog Stack Overflow Job Search: Better, Faster, Stronger Visit Chat Would you like to simply thank Tom for his years of sharing expertise with our community? Since it's a dev environment and I didn't know what condition the table was in, I reorged it and analyzed it just for kicks. Not always the case ...

Show me." and we said... Get back from select object to collection object Insert newline before each line matching a pattern unless the previous line is already empty Is there a standard DNS record to indicate