Hey there,
I'm trying to write an insert query that takes two different queries, and inserts the values based on the year inputed by the user...
what am I doing wrong? it keeps saying incorrect INSERT, but if i use "VALUE(...n)" it still doesn't work.
Thanks in advance,
John
I'm trying to write an insert query that takes two different queries, and inserts the values based on the year inputed by the user...
Code:
[sup]
insert into [pnltable] (totalsales, totalpurch, totalsupp, totaluniform, totalautoexp, totalofficeexp, totalphone)
(Select [ADMIN TotalCost Annual Totals].[Sum Of TotalCost] as [totalsales] FROM [ADMIN TotalCost Annual Totals] where [InvoiceDate By] = [year])
(Select [ADMIN Receipts Annual Totals].[Sum Of rprice] as a FROM [ADMIN Receipts Annual Totals] where [rdate By Year] = [year] and [rcat] = 'Purchases')
(Select [ADMIN Receipts Annual Totals].[Sum Of rprice] as a FROM [ADMIN Receipts Annual Totals] where [rdate By Year] = [year] and [rcat] = 'Suppliers')
(Select [ADMIN Receipts Annual Totals].[Sum Of rprice] as a FROM [ADMIN Receipts Annual Totals] where [rdate By Year] = [year] and [rcat] = 'Uniform')
(Select [ADMIN Receipts Annual Totals].[Sum Of rprice] as a FROM [ADMIN Receipts Annual Totals] where [rdate By Year] = [year] and [rcat] = 'Auto Expenses')
(Select [ADMIN Receipts Annual Totals].[Sum Of rprice] as a FROM [ADMIN Receipts Annual Totals] where [rdate By Year] = [year] and [rcat] = 'Office Supplies & Expenses')
(Select [ADMIN Receipts Annual Totals].[Sum Of rprice] as a FROM [ADMIN Receipts Annual Totals] where [rdate By Year] = [year] and [rcat] = 'Phone');
[/sup]
what am I doing wrong? it keeps saying incorrect INSERT, but if i use "VALUE(...n)" it still doesn't work.
Thanks in advance,
John