techwriterAR
MIS
I'm trying to build an excel 2007 spreadsheet by pulling data from an AS400 database. I am writing my query inside Excel using 'Get data from other sources'. This report is supposed to return quantity of each product sold from the current date to one year back. I need to set the date field to the current date - 365 days. However every thing I have tried does not work.
This part of my query works and returns over 90,000 records:
select a.prdno, b.txdta, a.ittdt, sum(a.quant)
from initp100c a inner join mftxp100x b on (a.prdno = b.text#) and (b.txtyp = 'PD') and (b.txsqn = 0)
where a.tcode in ('S')
group by a.prdno, b.txdta, a.ittdt
If I add the date criteria, the program returns the message - could not add the table 'initp100c'.
select a.prdno, b.txdta, a.ittdt, sum(a.quant)
from initp100c a inner join mftxp100x b on (a.prdno = b.text#) and (b.txtyp = 'PD') and (b.txsqn = 0)
where a.tcode in ('S') and a.ittdt <= [current date - (365 days)]
group by a.prdno, b.txdta, a.ittdt
I have tried every combination I can think of to get this thing to run. i searched the Microsoft Office forum by narrowing my criteria to excel ms query and tried everything I found. Nothing worked. I'm hoping someone can help me.
gjeffcoat
This part of my query works and returns over 90,000 records:
select a.prdno, b.txdta, a.ittdt, sum(a.quant)
from initp100c a inner join mftxp100x b on (a.prdno = b.text#) and (b.txtyp = 'PD') and (b.txsqn = 0)
where a.tcode in ('S')
group by a.prdno, b.txdta, a.ittdt
If I add the date criteria, the program returns the message - could not add the table 'initp100c'.
select a.prdno, b.txdta, a.ittdt, sum(a.quant)
from initp100c a inner join mftxp100x b on (a.prdno = b.text#) and (b.txtyp = 'PD') and (b.txsqn = 0)
where a.tcode in ('S') and a.ittdt <= [current date - (365 days)]
group by a.prdno, b.txdta, a.ittdt
I have tried every combination I can think of to get this thing to run. i searched the Microsoft Office forum by narrowing my criteria to excel ms query and tried everything I found. Nothing worked. I'm hoping someone can help me.
gjeffcoat