Update Query vs Append Query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kwc
    New Member
    • Nov 2006
    • 7

    Update Query vs Append Query

    I am pretty new at this, so please bear with me.

    I have a table with all my records. I update my table. Today, I updated my table with three new records. I want to take only those 3 records and put them into another smaller table which has only 4 fields. I can't make it happen... I can get it to Append all the records, but I only want the three new one.

    Your help is appreciated.
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    You have posted your question in the Articles section rather than the Forum section. I have moved it across for you.

    Linq ;0)>

    Comment

    • kwc
      New Member
      • Nov 2006
      • 7

      #3
      Thank you very much !


      Originally posted by missinglinq
      You have posted your question in the Articles section rather than the Forum section. I have moved it across for you.

      Linq ;0)>

      Comment

      • JKing
        Recognized Expert Top Contributor
        • Jun 2007
        • 1206

        #4
        Hi there. Could you post the metadata for the two tables you are using.

        Here is an example of how to post table MetaData :
        Table Name=tblStudent
        Code:
              Field; Type; IndexInfo
              StudentID; AutoNumber; PK
              Family; String; FK
              Name; String
              University; String; FK
              Mark; Numeric
              LastAttendance; Date/Time

        Comment

        • kwc
          New Member
          • Nov 2006
          • 7

          #5
          thanks for your help

          Table Name – tbl2007

          FieldName; Type,

          Item# AutoNumber
          Invoice #
          Invoice Code
          Description
          Date
          Acct#
          Return#
          ContactName
          ContactAddress
          ContactCity
          ContactState
          ContactZip


          I want to update tblStatus with only a few fields, and only the new records in tbl2007

          Table Name – tblStatus

          (Fields to be updated from tbl2007)

          Item# AutoNumber
          Invoice #
          Invoice Code
          Description

          Comment

          • JKing
            Recognized Expert Top Contributor
            • Jun 2007
            • 1206

            #6
            The append query would be something like this:

            [code=sql]
            INSERT into tblStatus (Item, Invoice, [Invoice Code], Description)
            SELECT tbl2007.Item, tbl2007.Invoice , tbl2007.[Invoice Code], tbl2007.Descrip tion
            FROM tbl2007
            WHERE tbl2007.Item Not In (SELECT tblStatus.Item From tblStatus)
            [/code]

            This is the basic lay out of what you will need to do. I'm assuming here that you will want to append any records from tbl2007 that aren't currently in tblStatus. This is handled by the where clause. If this is not the case how do you plan on determining which records are new in tbl2007? By date perhaps?

            Comment

            • kwc
              New Member
              • Nov 2006
              • 7

              #7
              Exactly what I needed. I will go try it...... thanks!

              Comment

              • FishVal
                Recognized Expert Specialist
                • Jun 2007
                • 2656

                #8
                Originally posted by kwc
                Exactly what I needed. I will go try it...... thanks!
                Hi, kwc.

                Just a silly question.

                What a special reason do you have to maintain separate table which is just field subset of another one?

                Why not to use simple query like this
                Code:
                SELECT tbl2007.Item, tbl2007.Invoice, tbl2007.[Invoice Code], tbl2007.Description
                FROM tbl2007
                to retrieve necessary data any time you like?

                Comment

                • kwc
                  New Member
                  • Nov 2006
                  • 7

                  #9
                  Originally posted by FishVal
                  Hi, kwc.

                  Just a silly question.

                  What a special reason do you have to maintain separate table which is just field subset of another one?

                  Why not to use simple query like this
                  Code:
                  SELECT tbl2007.Item, tbl2007.Invoice, tbl2007.[Invoice Code], tbl2007.Description
                  FROM tbl2007
                  to retrieve necessary data any time you like?
                  NEVER a silly question - it actually helps me think through how to do things in a better more efficient way. I greatly appreciated. My problem is - and help me if there is a better way - I have to export into excel, and in my excel spreadsheet (which I have to email to the managers) I add a few more fields and mess with it....

                  I am actually confusing and probably complicating my situation with multiple places where I need to update data...

                  Comment

                  • FishVal
                    Recognized Expert Specialist
                    • Jun 2007
                    • 2656

                    #10
                    Originally posted by kwc
                    NEVER a silly question - it actually helps me think through how to do things in a better more efficient way. I greatly appreciated. My problem is - and help me if there is a better way - I have to export into excel, and in my excel spreadsheet (which I have to email to the managers) I add a few more fields and mess with it....

                    I am actually confusing and probably complicating my situation with multiple places where I need to update data...
                    Ok. I have some additional questions.
                    • You want to export to excel only some records from tbl2007. What criteria do you want to use to select records (date range, those never been sent previously etc.) ?
                    • What are these additional fields in excel spreadsheet? I mean whether they are being added to each record becoming a part of query or they are separate single fields?
                    • Do you want to use some template excel file or you want to build it from scratch?

                    Comment

                    • NeoPa
                      Recognized Expert Moderator MVP
                      • Oct 2006
                      • 32645

                      #11
                      Fish, you're on the right lines there. The OP probably doesn't want a separate table for this stuff.
                      KWC, if you can answer FishVal clearly I'm sure he can help you to do this in a more straightforward (natural) way.

                      Comment

                      Working...