Append Query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a table of trades and each has an account number. I want to create a
table of all account numbers where account numbers will be the primary key.
How do I write a query that insert but prevents duplicated account entry?

// <-- signifies comment
// This query below inserts all account #'s

INSERT INTO Accounts ( account_code )
SELECT Trades.account_code
FROM Trades
 
Hi Denton,

You are almost there... just need to group your results like this:

INSERT INTO Accounts ( account_code )
SELECT Trades.account_code
FROM Trades
group by Trades.account_code

Hope this helps.

Damian.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Simple Join Queries 7
Query 9
New Query 7
Access 2003 Functionality 2
Query. 2
Creating a Query based of two diffent data tables 1
Report 1
Append Query Issues... 5

Back
Top