Query problem

Results 1 to 2 of 2

Thread: Query problem

  1. #1
    Join Date
    Dec 1969

    Default Query problem

    Must be getting punch drunk here.<BR><BR>I need a single month and each year for each month.<BR><BR>Here&#039;s what I have now:<BR><BR>SQL="SELECT Sum(env_data.amount) AS monthly_Total, Month(collection_date) AS month_name, "_ <BR>& "Year([collection_date]) AS yr FROM env_data "_<BR>& "GROUP BY Month(collection_date), Year([collection_date]) "_<BR>& "ORDER BY Month(collection_date), Year([collection_date]); "<BR><BR>That gives me:<BR><BR>1999 jan amount<BR>2000 jan amount<BR>2001 jan amount<BR>and so on for each month and year<BR><BR>What I want is:<BR><BR> 1999 2000 20001 etc<BR>Jan amt amt amt <BR>Feb amt amt amt <BR>Mar amt amt amt <BR>etc<BR><BR>I cant seem to phrase the query to give all 12 months once and each of the years once.<BR><BR>Any help is bowed to.<BR><BR>Thanks

  2. #2
    Join Date
    Dec 1969

    Default ASPFAQs, category Databases, General

    Same as always:<BR><BR>http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=154<BR><BR>Where you generate a new row each time the month changes.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts