Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 6th, 2003, 10:53 AM
Authorized User
 
Join Date: Jun 2003
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to nlicata
Default NEW QUESTION - sum'ing filtered columns

All,

I previously asked about getting the sum of a columnin a db. I figured out to add an item to SELECT statement to create a variable:

txtSQL.CommandText = "SELECT customer_number, past_due_30, SUM(total_due) AS 'intTotalDue'" & _
                     "FROM accounts_receivable" & _
                     "WHERE past_due_30 > '0'" & _
                     "ORDER BY past_due_30 DESC ;"

But this appears to create a variable named intTotalDue that is the total of the entire column (total_due) from the database, not just the total of the column (total_due) in the recordset.. How do I total just the filtered record's column? Do I have to create a nested SELECT statement or can I use the HAVING clause - if so how?

thanks a lot,
Nick





Similar Threads
Thread Thread Starter Forum Replies Last Post
vba question on adding certain columns csilla Excel VBA 0 July 30th, 2008 05:25 AM
Trigger question for columns with text in MS sql s robtay SQL Server 2000 1 November 12th, 2006 03:21 PM
Filtered Sharepoint list, not filtered in infopath wmrdude SharePoint Development 0 July 26th, 2006 05:09 AM
Getting value of filtered datagrid row ashley_y VB How-To 1 November 23rd, 2004 10:48 AM
sum'ing columns after a filter (in rs) nlicata SQL Server ASP 2 August 21st, 2003 03:52 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.