Wendy - “GroupBy” can be thought of as - "consider identical lines (when All GroupBy fields match), as a single line.
Starting with the following data
OrdNum OrdLine OrdRel PartNum RelQty ExtCost
1000 1 1 ANVIL 5 500
1000 1 2 ANVIL 7 700
1000 2 1 JETPACK 1 2500
1001 1 1 BB's 500 250
1002 1 1 MAGNET 1 900
1003 1 1 ANVIL 3 300
If my BAQ displays just one column OrderNum
, my output would be
OrdNum
1000
1000
1000
1001
1002
1003
If my BAQ displays just one column OrderNum
and GroupBy is selected, my output would be
OrdNum
1000
1001
1002
1003
(it put all the records whose OrdNum was the same in a single row)
If I add the PartNum field (but not Grouped by) and still have OrderNum Grouped by, I’d get:
OrdNum PartNum
1000 ANVIL
1000 ANVIL
1000 JETPACK
1001 BB's
1002 MAGNET
1003 ANVIL
Even though the first two are the same, they aren’t combined because the PartNum column is not GroupBy.
Setting GroupBy on the PartNum column to would yield
OrdNum PartNum
1000 ANVIL
1000 JETPACK
1001 BB's
1002 MAGNET
1003 ANVIL
The first two rows are combined because OrdNum and PartNum are the same on each.
Back to just having the OrdNum s the only column (and GroupBy set for it), adding column for Line Count (COUNT(OrdLine)
as LineCnt
, could be any field really), yeilds
OrdNum LineCnt
1000 3
1001 2
1002 1
That first one is 3, and not the expected 2, because there are three records that have the same OrdNum of 1000.
Hope that helps