Select INtO FROM help

greg85374
12-06-2005, 01:01 PM
I Keep getting the infamous error..the column name 'whatever' appears more than once..blah blah.
the problem is i need it more than once. Im using the following sql statement.
Any help would be highly appreciated...

the 'Whatever' part comes in on the last 2 lines before the word FROM

INSERT INTO [TblTransactions]
([TRAssocID],[TRAccCode],[TRAccSubCode],[cidTransType],
[TRDescription1],[TRDescription2],[TRTransDate],[TRTransAmount],
[TRCashType],[TRCheckNumber],[TRVID],[TRInvoiceNumber],
[cidDept],[TRFlag1099],[TRBankCode],[TrBankSubCode],
[TREntryPeriod],[TRBathcNumber],[TRSequenceNumber],[TREduCID],
[TREdMeetNumber],[TREducMeetYear],[TRBankCode],[TRBankSubCode],
[TrGlCode],[TrGlBank])
SELECT
[TRAssocID],[TRAccCode],[TRAccSubCode],[cidTransType],
[TRDescription1],[TRDescription2],[TRTransDate],[TRTransAmount],
[TRCashType],[TRCheckNumber],[TRVID],[TRInvoiceNumber],
[cidDept],[TRFlag1099],[TRBankCode],[TrBankSubCode],
[TREntryPeriod],[TRBathcNumber],[TRSequenceNumber],[TREduCID],
[TREdMeetNumber],[TREducMeetYear],[TRBankCode],[TRBankSubCode],
([TRAccCode] + [TRAccSubCode]) AS [TrAccCode],
([TRBankCode] + [TRBankSubCode]) AS [TrGlBank]
FROM [TblAdjInput] WHERE [TRAssocID] = '2'

00100b
12-06-2005, 04:27 PM
This block:

([TRAccCode] + [TRAccSubCode]) AS [TrAccCode],

of your SELECT statement is the cause. Your second field in the SELECT statement is already called [TRAccCode].

Since the above calculation is supposed to go into the field [TrGlCode] in your INSERT statement, shouldn't the above block be:

([TRAccCode] + [TRAccSubCode]) AS [TrGlCode],

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum