Results 1 to 5 of 5
  1. #1
    gar is offline Advanced Beginner
    Windows 7 32bit Access 2013
    Join Date
    Nov 2011
    Posts
    42

    Where can I find definitive SQL documentation.

    Can anyone tell me where I can find definitive documentation on SQL (or Access' implementation of it)? My question is prompted by my discovery of an instance of the use of the "DISTINCTROW" qualifier (if that's the right word) in a select query and my fruitless attempts to find out precisely how this works (and how, in particular, it's functionality differs from that of "DISTINCT".

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Review: http://office.microsoft.com/en-us/ac...001032205.aspx

    Basically, use DISTINCT and Smith will show only once no matter how many customers are named Smith. But use DISTINCTROW and each customer with last name Smith will result in a record (doesn't have to be joined tables but that seems to be where it would be most appropriate, although I've never encountered a need for DISTINCTROW).

    Example dataset of tables joined without DISTINCT or DISTINCTROW.

    CustID Last First OrderID
    1 Jones A 123
    2 Carson C 456
    3 Smith M 789
    4 Smith T 654
    4 Smith T 987

    SELECT DISTINCT Last FROM query;
    returns:
    Jones
    Carson
    Smith

    SELECT DISTINCTROW Last FROM query;
    returns:
    Jones
    Carson
    Smith
    Smith

    I would have thought that the OrderID would make every row 'distinct'. I am guessing the programming for DISTINCTROW in the SQL engine is using the PK/FK in conjunction with the Last field to identify 'distinctness'. This means CustID and First fields can be included but OrderID cannot.
    Last edited by June7; 10-27-2013 at 11:04 AM.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870

  4. #4
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,538
    This is my goto site for SQL syntax

    http://www.w3schools.com/sql/default.asp

  5. #5
    gar is offline Advanced Beginner
    Windows 7 32bit Access 2013
    Join Date
    Nov 2011
    Posts
    42
    Thanks to all those who replied; I think I have it sorted out now.

    Quote Originally Posted by alansidman View Post
    This is my goto site for SQL syntax

    http://www.w3schools.com/sql/default.asp

Please reply to this thread with any new information or opinions.

Similar Threads

  1. SQL Server Views documentation
    By RayMilhon in forum SQL Server
    Replies: 0
    Last Post: 09-04-2013, 11:35 AM
  2. I can't find the bug. Please help
    By sharVyn in forum Programming
    Replies: 5
    Last Post: 08-27-2012, 03:39 PM
  3. ADO API documentation. Where?
    By graffiti in forum Access
    Replies: 1
    Last Post: 01-14-2012, 12:26 AM
  4. VBA Syntax Documentation
    By MDB in forum Programming
    Replies: 4
    Last Post: 08-30-2011, 09:37 AM
  5. Need Documentation
    By umair in forum Access
    Replies: 1
    Last Post: 02-17-2010, 08:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums