Ahhh....OK....now I see the dilema.

It comes down to the fact that you want 2 different levels of aggregation:
1) all records in a date range
2) all unique combos of 3 fields in a date range

So this will have to be 2 queries unless you want to go uber complex (and I'm 
not even sure that would work in the end.....one of those  "have to try to find 
out" deals).

So # 1 above is a cake walk

SELECT SUM(application),
               COUNT(*)
  FROM aTable
WHERE date >= theStartDate
    AND date <=  theEndDate

#2 is not too bad either

SELECT COUNT(*),
               grower,
               field,
               crop
  FROM aTable
WHERE date >= theStartDate
    AND date <=  theEndDate
GROUP BY grower,field,crop

Now the whole ball of wax could possibly be rolled into one using sub-queries 
and merging that back together in a outer query....but like I said....that 
could 
take some figurin ;-)

HTH

Cheers

Bryan Stevenson B.Comm.
VP & Director of E-Commerce Development
Electric Edge Systems Group Inc.
phone: 250.480.0642
fax: 250.480.1264
cell: 250.920.8830
e-mail: [EMAIL PROTECTED]
web: www.electricedgesystems.com

Notice:
This message, including any attachments, is confidential and may contain
information that is privileged or exempt from disclosure. It is intended
only for the person to whom it is addressed unless expressly authorized
otherwise by the sender. If you are not an authorized recipient, please
notify the sender immediately and permanently destroy all copies of this
message and attachments. 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion 8 - Build next generation apps
today, with easy PDF and Ajax features - download now
http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf

Archive: http://www.houseoffusion.com/groups/SQL/message.cfm/messageid:2928
Subscription: http://www.houseoffusion.com/groups/SQL/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.6

Reply via email to