Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Re: Append Query question!

Discussion in 'Information Technology' started by Mark Cline, Jul 28, 2006.

  1. Mark Cline

    Mark Cline
    Expand Collapse
    Guest

    I put that into the criteria area of my append query and got syntax errors
    that I could not correct as I am new to this. Is there a misplaced
    paranthesis somewhere?

    "Brendan Reynolds" wrote:

    > Here's an example that uses two copies of the Orders table from the
    > Northwind database ...
    >
    > INSERT INTO Orders2 ( OrderID, CustomerID, EmployeeID, OrderDate,
    > RequiredDate, ShippedDate, ShipVia, Freight, ShipName, ShipAddress,
    > ShipCity, ShipRegion, ShipPostalCode, ShipCountry )
    > SELECT Orders1.OrderID, Orders1.CustomerID, Orders1.EmployeeID,
    > Orders1.OrderDate, Orders1.RequiredDate, Orders1.ShippedDate,
    > Orders1.ShipVia, Orders1.Freight, Orders1.ShipName, Orders1.ShipAddress,
    > Orders1.ShipCity, Orders1.ShipRegion, Orders1.ShipPostalCode,
    > Orders1.ShipCountry
    > FROM Orders1 WHERE Orders1.OrderID NOT IN (SELECT Orders2.OrderID FROM
    > Orders2);
    >
    > --
    > Brendan Reynolds
    > Access MVP
    >
    >
    > "JOM" <JOM@discussions.microsoft.com> wrote in message
    > news:13FAADA8-A28D-4634-9508-912681A4DF2D@microsoft.com...
    > > Is it possible to do append query to unique records. As in If one forgets
    > > and presses the append query more than once, there is a possiblility that
    > > the
    > > same records would be appended more that once. What I would like to do is
    > > one runs the append query, don't append the same records or have duplicate
    > > records in the appended table...

    >
    >
    >
     
  2. Loading...

    Similar Threads Forum Date
    Query about Jhatka Meat by Shooting in Head Sikh Sikhi Sikhism Aug 26, 2011
    Who is a sikh? A non sikh friend's query!! Sikh Sikhi Sikhism Apr 30, 2010
    General Query Hard Talk Sep 4, 2008
    Power of pauri's in Japji Sahib query Sikh Sikhi Sikhism Aug 17, 2006
    Sikhism a query Book Reviews & Editorials Aug 2, 2005

  3. Brendan Reynolds

    Brendan Reynolds
    Expand Collapse
    Guest

    What exactly did you put in the criteria area of your query? In the example
    I posted, the criteria is everything between 'WHERE' and the semi-colon,
    exclusive, that is to say not including the word 'WHERE' or the semi-colon.
    And of course you would need to change the table and field names to your
    actual table and field names.

    --
    Brendan Reynolds
    Access MVP


    "Mark Cline" <Mark Cline@discussions.microsoft.com> wrote in message
    news:F1C70878-1244-4CBF-A1BD-2AE72EB29B6F@microsoft.com...
    >I put that into the criteria area of my append query and got syntax errors
    > that I could not correct as I am new to this. Is there a misplaced
    > paranthesis somewhere?
    >
    > "Brendan Reynolds" wrote:
    >
    >> Here's an example that uses two copies of the Orders table from the
    >> Northwind database ...
    >>
    >> INSERT INTO Orders2 ( OrderID, CustomerID, EmployeeID, OrderDate,
    >> RequiredDate, ShippedDate, ShipVia, Freight, ShipName, ShipAddress,
    >> ShipCity, ShipRegion, ShipPostalCode, ShipCountry )
    >> SELECT Orders1.OrderID, Orders1.CustomerID, Orders1.EmployeeID,
    >> Orders1.OrderDate, Orders1.RequiredDate, Orders1.ShippedDate,
    >> Orders1.ShipVia, Orders1.Freight, Orders1.ShipName, Orders1.ShipAddress,
    >> Orders1.ShipCity, Orders1.ShipRegion, Orders1.ShipPostalCode,
    >> Orders1.ShipCountry
    >> FROM Orders1 WHERE Orders1.OrderID NOT IN (SELECT Orders2.OrderID FROM
    >> Orders2);
    >>
    >> --
    >> Brendan Reynolds
    >> Access MVP
    >>
    >>
    >> "JOM" <JOM@discussions.microsoft.com> wrote in message
    >> news:13FAADA8-A28D-4634-9508-912681A4DF2D@microsoft.com...
    >> > Is it possible to do append query to unique records. As in If one
    >> > forgets
    >> > and presses the append query more than once, there is a possiblility
    >> > that
    >> > the
    >> > same records would be appended more that once. What I would like to do
    >> > is
    >> > one runs the append query, don't append the same records or have
    >> > duplicate
    >> > records in the appended table...

    >>
    >>
    >>
     
  4. Brendan Reynolds

    Brendan Reynolds
    Expand Collapse
    Guest

    Correction - if you were typing that into the criteria row in query design
    view, you would also leave out the name of the column, so the criteria would
    look like ...

    NOT IN (SELECT Orders2.OrderID FROM Orders2)

    .... not forgetting to replace 'Orders2' with the name of your target table
    (the table to which you are appending) and 'OrderID' with the name of a
    suitable column (the primary key column or another column with a unique
    index).

    --
    Brendan Reynolds
    Access MVP

    "Brendan Reynolds" <brenreyn@discussions.microsoft.com> wrote in message
    news:%23rfaU4uiGHA.456@TK2MSFTNGP05.phx.gbl...
    > What exactly did you put in the criteria area of your query? In the
    > example I posted, the criteria is everything between 'WHERE' and the
    > semi-colon, exclusive, that is to say not including the word 'WHERE' or
    > the semi-colon. And of course you would need to change the table and field
    > names to your actual table and field names.
    >
    > --
    > Brendan Reynolds
    > Access MVP
    >
    >
    > "Mark Cline" <Mark Cline@discussions.microsoft.com> wrote in message
    > news:F1C70878-1244-4CBF-A1BD-2AE72EB29B6F@microsoft.com...
    >>I put that into the criteria area of my append query and got syntax errors
    >> that I could not correct as I am new to this. Is there a misplaced
    >> paranthesis somewhere?
    >>
    >> "Brendan Reynolds" wrote:
    >>
    >>> Here's an example that uses two copies of the Orders table from the
    >>> Northwind database ...
    >>>
    >>> INSERT INTO Orders2 ( OrderID, CustomerID, EmployeeID, OrderDate,
    >>> RequiredDate, ShippedDate, ShipVia, Freight, ShipName, ShipAddress,
    >>> ShipCity, ShipRegion, ShipPostalCode, ShipCountry )
    >>> SELECT Orders1.OrderID, Orders1.CustomerID, Orders1.EmployeeID,
    >>> Orders1.OrderDate, Orders1.RequiredDate, Orders1.ShippedDate,
    >>> Orders1.ShipVia, Orders1.Freight, Orders1.ShipName, Orders1.ShipAddress,
    >>> Orders1.ShipCity, Orders1.ShipRegion, Orders1.ShipPostalCode,
    >>> Orders1.ShipCountry
    >>> FROM Orders1 WHERE Orders1.OrderID NOT IN (SELECT Orders2.OrderID FROM
    >>> Orders2);
    >>>
    >>> --
    >>> Brendan Reynolds
    >>> Access MVP
    >>>
    >>>
    >>> "JOM" <JOM@discussions.microsoft.com> wrote in message
    >>> news:13FAADA8-A28D-4634-9508-912681A4DF2D@microsoft.com...
    >>> > Is it possible to do append query to unique records. As in If one
    >>> > forgets
    >>> > and presses the append query more than once, there is a possiblility
    >>> > that
    >>> > the
    >>> > same records would be appended more that once. What I would like to
    >>> > do is
    >>> > one runs the append query, don't append the same records or have
    >>> > duplicate
    >>> > records in the appended table...
    >>>
    >>>
    >>>

    >
    >
     

Share This Page