thevillageinn
Technical User
My head is spinning with ideas, but I'm having a hard time putting any of them together.
My DB is something like this (acc97):
4 tables - 2 are SQL Server tables, 1 is a local table, and the last is the table I want to insert the data into (also local).
I have a connection string for the SQL Server database, but I'm having trouble figuring out how to reference those two tables in the SQL statement and insert the data into my local table.
Currently, the SQL Server tables are linked via ODBC DSN, but that has to go.
My tables are as follows:
dbo_Customer_File_Copy - SQL Server table
dbo_User_Id_File_Copy - SQL Server table
112999 - local table
Cdr_UserCostMoreThan50 - intended destination
And now for my SQL from the query builder...
I really appreciate anyone sticking with me through that SQL Statement. I don't have much experience with how to parse or split the statement into something Access will like.
Many thanks in advance
-Dan
My DB is something like this (acc97):
4 tables - 2 are SQL Server tables, 1 is a local table, and the last is the table I want to insert the data into (also local).
I have a connection string for the SQL Server database, but I'm having trouble figuring out how to reference those two tables in the SQL statement and insert the data into my local table.
Currently, the SQL Server tables are linked via ODBC DSN, but that has to go.
My tables are as follows:
dbo_Customer_File_Copy - SQL Server table
dbo_User_Id_File_Copy - SQL Server table
112999 - local table
Cdr_UserCostMoreThan50 - intended destination
And now for my SQL from the query builder...
Code:
SELECT dbo_Customer_File_Copy.CustNo, dbo_Customer_File_Copy.Nam, Count([112999].BillingNo) AS NumberOfCalls, [112999].BillingNo AS UserId, Sum((Val([AccessCost])/10000)+(Val([OrigTrnspCost])/10000)+(Val([TermTrnspCost])/10000)+(Val([EgCost])/10000)) AS Cost, dbo_Customer_File_Copy.ServDat, dbo_Customer_File_Copy.LstStmntDat, dbo_Customer_File_Copy.LstStmntAmt, dbo_Customer_File_Copy.Bal INTO Cdr_UserCostMoreThan50
FROM 112999 INNER JOIN (dbo_Customer_File_Copy INNER JOIN dbo_User_Id_File_Copy ON dbo_Customer_File_Copy.CustNo = dbo_User_Id_File_Copy.CustNo) ON [112999].BillingNo = dbo_User_Id_File_Copy.UserId
GROUP BY dbo_Customer_File_Copy.CustNo, dbo_Customer_File_Copy.Nam, [112999].BillingNo, dbo_Customer_File_Copy.ServDat, dbo_Customer_File_Copy.LstStmntDat, dbo_Customer_File_Copy.LstStmntAmt, dbo_Customer_File_Copy.Bal
HAVING (((Sum((Val([AccessCost])/10000)+(Val([OrigTrnspCost])/10000)+(Val([TermTrnspCost])/10000)+(Val([EgCost])/10000)))>50));
I really appreciate anyone sticking with me through that SQL Statement. I don't have much experience with how to parse or split the statement into something Access will like.
Many thanks in advance
-Dan