I have MS Excel 2010 and am receiving an error message with the following sql query within MSquery...
SELECT invoice_line.item_id, Count(invoice_line.line_no) AS 'units', Sum(invoice_line.qty_shipped) AS 'Sum of qty_shipped'
FROM Prophet21_12_Live.dbo.invoice_hdr invoice_hdr, Prophet21_12_Live.dbo.invoice_line invoice_line
WHERE invoice_line.invoice_no = invoice_hdr.invoice_no
GROUP BY invoice_line.item_id, invoice_hdr.period, invoice_hdr.year_for_period
HAVING (invoice_line.item_id Between 'ap labor 021' And 'ap labor wa') AND (invoice_hdr.period=[enter period]) AND (invoice_hdr.year_for_period=[enter year])
ORDER BY invoice_line.item_id
Error is
'Invalid Column Name' enter period
'Invalid Column Name' enter year
Statesment(s) could not be prepared.
I can enter values in for the year and period and get data.
I can enter other queries using [] for input data and it works.
The error is stumping me.
SELECT invoice_line.item_id, Count(invoice_line.line_no) AS 'units', Sum(invoice_line.qty_shipped) AS 'Sum of qty_shipped'
FROM Prophet21_12_Live.dbo.invoice_hdr invoice_hdr, Prophet21_12_Live.dbo.invoice_line invoice_line
WHERE invoice_line.invoice_no = invoice_hdr.invoice_no
GROUP BY invoice_line.item_id, invoice_hdr.period, invoice_hdr.year_for_period
HAVING (invoice_line.item_id Between 'ap labor 021' And 'ap labor wa') AND (invoice_hdr.period=[enter period]) AND (invoice_hdr.year_for_period=[enter year])
ORDER BY invoice_line.item_id
Error is
'Invalid Column Name' enter period
'Invalid Column Name' enter year
Statesment(s) could not be prepared.
I can enter values in for the year and period and get data.
I can enter other queries using [] for input data and it works.
The error is stumping me.