Select Statement in query to append to a table

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

Guest

Hello,

I have a table with the following

Master Stock Code
Header ID

and I want to append this information to a table, kind of ike a cross tab
query but I want the value of the header ID to be in the column not as a
column name. I have a max of 12 header id's, so I have 12 column names in
the table i want to append to (ie. Hdr1, Hdr2 etc)

There could be more than one Header ID per stock code.

WHat is the proper syntax for the select statement in my query so I don't
get duplicate rows per stock code.
 
One approach will be, create a key in the table you appending data to, and
the key won't allow dupliates.

The row will be appended once.
 
My table has the stock code as the key and my append query looks like this
for one of the header columns:

Header2: IIf(Nz([HdrCnt],0)="2",[Hdr],0)

I do this for each of the headers up to 12.

But when I run the query, it looks like it's trying to create duplicate rows
for the stock codes because I get a violation error on the key.

So for example, a row would like like:

MF343 1' 2' 3' (possibly up to '12)


Thanks!
 
Back
Top