title: How to insert records from one table to another using trigger in SQL Server?
body: <p>I want to insert the data from one table to another. The condition is if the first table having only record then only that record I need to insert into the another table.</p>
  
  <p>I am trying Query :</p>
  
  <pre><code>INSERT INTO Customer_Map_Address(CustomerID, AddressID, IsBillingAddress)
  SELECT [CustomerID], [ID], CAST('FALSE' as BIT) AS IsBillingAddress 
  FROM CustomerAddress Group By CustomerID, ID
  having COUNT(CustomerID) = 1
  </code></pre>
  
  <p>It is Grouped by CustomerID and ID hence getting wrong output. I want to group only by CustomerID.</p>
  
  <p>Thanks.</p>