I have many tables in my database and I am collecting calculated values with following code and would like to Insert those values into other table. I am Using SELECT INTO method but database tells me that "Incorrect syntax near the keyword INTO line ...". I believe that there is something I am missing but not sure where. Code looks fine. Here is my code. Any help would be appreciated.
SELECT (second.[cdate]=@enddate) AS 'Date', first.[machine_no] AS 'No',
tbl_machines.[manufacturer] As 'Manufacturer',
tbl_machines.[type] As 'Machine Type',tbl_machines.[game_name] AS 'Game Name',
tbl_machines.[accounting_denomination] AS 'Denom',
(second.[turnover])-(first.[turnover]) AS 'Turnover',
(second.[total win])-(first.[total win]) AS 'Total win',
(second.[games played])-(first.[games played]) AS 'Games Played',
(second.[Bill in])-(first.[Bill in]) AS 'Bill In',
(second.[credit in])-(first.[credit in]) AS 'Credit IN',
(second.[cancel credit])-(first.[cancel credit]) AS 'Cancel Credit',
tbl_rate.[euro] AS 'euro rate',
tbl_rate.[dollar] AS 'dollar rate'
INTO tbl_daily
FROM tbl.meter first,tbl.machines,tbl_rate
INNER JOIN tbl_meter second ON first.[Machine_No] = second.[Machine_No]
AND
tbl_machines.[local_no]=first.[machine_no]
WHERE first.[cDate] = @StartDate
AND second.[cDate] = @EndDate
AND tbl_rate.[cdate]=@enddate;