Table Connections and Grouping in Excel MS Query

samthomasny

New Member
Joined
Nov 19, 2011
Messages
9
Can someone please help me with this sql statement for Excel MS Query? I tried my best and couldn't get it to work. All I want is two columns - Sum of DTOTAL grouped by HENTDT (order date). I prefer to have date range parameters picked up from two cells in Excel, but not necessarily; I could hard code the date in sql as >20131231. But I have to keep the other 3 criteria.

SELECT GTORHD.HENTDT, Sum(GTORDT.DTOTAL) as SumOfDTOTAL
FROM POSPRO.QS36F.GTORDT GTORDT, POSPRO.QS36F.GTORHD GTORHD
WHERE GTORDT.DORD# = GTORHD.HORD# AND ((GTORHD.HENTDT>=? And GTORHD.HENTDT<=?) AND (GTORHD.HORSTS<>'C') AND (GTORDT.DSTATS<>'C') AND (GTORHD.HORSRC='W'))
 

Forum statistics

Threads
1,085,589
Messages
5,384,632
Members
401,913
Latest member
chethan av

Some videos you may like

This Week's Hot Topics

Top