Re: [PHP] Column Totals

2004-11-15 Thread Robby Russell
On Mon, 2004-11-15 at 11:01 -0700, Ben Miller wrote: > SELECT SUM(Revenue) FROM Sales WHERE Date='$Date' What happens when you do: SELECT Revenue FROM Sales WHERE Date='$Date'; Make sure you're getting values back first..and then you can try to sum them. -Robby -- /**

Re: [PHP] Column Totals

2004-11-15 Thread Jason Wong
On Tuesday 16 November 2004 02:21, Ben Miller wrote: > That did it perfectly. Why don't any of the stupid books tell you that you > need the AS statement? You don't *need* the AS. You just need to be aware that without the AS the query will return a column called 'SUM(columnname)'. The AS is for

RE: [PHP] Column Totals

2004-11-15 Thread Gryffyn, Trevor
ome pitfalls to watch out for when you're not used to aggregates and grouping. -TG > -Original Message----- > From: Ben Miller [mailto:[EMAIL PROTECTED] > Sent: Monday, November 15, 2004 1:22 PM > To: [EMAIL PROTECTED] > Subject: RE: [PHP] Column Totals > > >

Re: [PHP] Column Totals

2004-11-15 Thread Greg Donald
On Mon, 15 Nov 2004 11:21:45 -0700, Ben Miller <[EMAIL PROTECTED]> wrote: > That did it perfectly. Why don't any of the stupid books tell you that you > need the AS statement? Because they assumed you would access it just like you asked for it. $bar['SUM(Revenue)'] -- Greg Donald Zend Certifi

RE: [PHP] Column Totals

2004-11-15 Thread Ben Miller
That did it perfectly. Why don't any of the stupid books tell you that you need the AS statement? -Original Message- From: Jay Blanchard [mailto:[EMAIL PROTECTED] Sent: Monday, November 15, 2004 11:16 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] Column Totals

Re: [PHP] Column Totals

2004-11-15 Thread raditha dissanayake
Ben Miller wrote: I am trying to get the total sales revenue for each day of the month, and having no luck at all. In case it helps, sample table data might look like this: OrderNoOrderDateRevenue 1 79.95 1112 1

RE: [PHP] Column Totals

2004-11-15 Thread Ben Miller
-Original Message- From: Robby Russell [mailto:[EMAIL PROTECTED] Sent: Monday, November 15, 2004 11:12 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Column Totals On Mon, 2004-11-15 at 11:01 -0700, Ben Miller wrote: > SELECT SUM(Revenue) FROM Sales WHERE Date=&#x

RE: [PHP] Column Totals

2004-11-15 Thread Jay Blanchard
[snip] The following query seems to return an empty string, which should only give me the total for the entire column anyway. $query = "SELECT SUM(Revenue) FROM Sales WHERE Date='$Date'"; [/snip] $query = "SELECT SUM(Revenue) AS Revenue FROM Sales WHERE Date='$Date'"; note the AS statement