title: Trigger for update audit table with new and old values
body: <p>I have two tables one Products and Products_audit and I want to use Products_audit like audit table so I want to use trigger After Update. I wrote trigger but can't understand how to joing two tables 'Inserted' and 'Deleted' </p>
  
  <pre><code>CREATE TRIGGER Super2
  ON Products
  AFTER Update
  AS
  BEGIN
  
  INSERT INTO Products_audit
  
        (ProductID,
         ProductName,
         SupplierID,
         CategoryID,
         QuantityPerUnit,
         UnitPrice,
         UnitsInStock,
         UnitsOnOrder,
         ReorderLevel,
         Discontinued,
         Date,
         [User])
  
  SELECT 
  
         ProductID,
         ProductName,
         SupplierID,
         CategoryID,
         QuantityPerUnit,
         UnitPrice,
         UnitsInStock,
         UnitsOnOrder,
         ReorderLevel,
         Discontinued,
         getdate(),
         suser_sname()
  
         FROM deleted
  
  inserted 
      inner join deleted d on i.id = d.id
  
        END 
  </code></pre>
  
  <p>Please help me write lastes strings</p>
  
  <pre><code>FROM deleted
  inserted 
      inner join deleted d on i.id = d.id
  
        END
  </code></pre>
  
  <p>Cause I didn't get how to write them in correct way.</p>