;
Sent: Thursday, October 16, 2003 19:41
Subject: RE: Challenging query
> On Thu, 2003-10-16 at 17:42, Jeff McKeon wrote:
> > Is there a way to generate a "line number" for a query return within the
> > returned rows??
> >
> > For instance, if I return 5 rows
ah, that will work fine.
Jeff
-Original Message-
From: Gabriel Ricard [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 16, 2003 2:11 PM
To: Jeff McKeon
Cc: [EMAIL PROTECTED]
Subject: Re: Challenging query
On Thursday, October 16, 2003, at 02:04 PM, Jeff McKeon wrote:
Do this quer
te it to a file?
Jeff
> -Original Message-
> From: Gabriel Ricard [mailto:[EMAIL PROTECTED]
> Sent: Thursday, October 16, 2003 2:11 PM
> To: Jeff McKeon
> Cc: [EMAIL PROTECTED]
> Subject: Re: Challenging query
>
>
>
> On Thursday, October 16, 2003, at
ustomerID'] ] = $result['Revenue'];
}
The result will be a simple multi-dimensional array with a
minimal SQL
query and minimal application code.
Jeff
-Original Message-
From: Gabriel Ricard [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 16, 2003 1:47 PM
To: Jeff McKeon;
t['CustomerID'] ] = $result['Revenue'];
> }
>
> The result will be a simple multi-dimensional array with a
> minimal SQL
> query and minimal application code.
Jeff
> -Original Message-
> From: Gabriel Ricard [mailto:[EMAIL PROTECTED]
> Sen
icated if you have more than 26
clients :)
but still doable.
HTH
Rory McKinley
Nebula Solutions
+27 82 857 2391
[EMAIL PROTECTED]
"There are 10 kinds of people in this world,
those who understand binary and those who don't" (Unknown)
----- Original Message -
From: "Jeff McK
On Thu, 2003-10-16 at 17:42, Jeff McKeon wrote:
> Is there a way to generate a "line number" for a query return within the
> returned rows??
>
> For instance, if I return 5 rows from a query, is there a command or
> function I can put in a query to add a column that contains the row
> number retur
Rory McKinley
Nebula Solutions
+27 82 857 2391
[EMAIL PROTECTED]
"There are 10 kinds of people in this world,
those who understand binary and those who don't" (Unknown)
- Original Message -----
From: "Jeff McKeon" <[EMAIL PROTECTED]>
To: "Rory McKinley&qu
> If you have a way to generate the query code dynamically
> (e.g. using a loop in C, PHP etc.), you can build a query
> using aliased tables :
>
> SELECT YEAR(a.date) AS year, MONTH(a.date) AS month,
> SUM(a.revenue) AS cust1_rev,
> SUM(b.revenue) AS cust2_rev, SUM(c.revenue) AS cust3_rev
> F
Hi
If you have a way to generate the query code dynamically (e.g. using a loop
in C, PHP etc.), you can build a query using aliased tables :
SELECT YEAR(a.date) AS year, MONTH(a.date) AS month, SUM(a.revenue) AS
cust1_rev,
SUM(b.revenue) AS cust2_rev, SUM(c.revenue) AS cust3_rev
FROM revenue a, r
6, 2003 11:40 AM
> To: Jeff McKeon
> Cc: [EMAIL PROTECTED]
> Subject: Re: Challenging query
>
>
> I think the closest you can get is something like this:
>
> SELECT YEAR(TheDate) AS Year,MONTH(TheDate) AS
> Month,CustomerName,CustomerID,SUM(Revenue*Quantity) AS
w | blah | blew |
| row | blah | blew |
Jeff
> -Original Message-
> From: Gabriel Ricard [mailto:[EMAIL PROTECTED]
> Sent: Thursday, October 16, 2003 11:40 AM
> To: Jeff McKeon
> Cc: [EMAIL PROTECTED]
> Subject: Re: Challenging query
>
I think the closest you can get is something like this:
SELECT YEAR(TheDate) AS Year,MONTH(TheDate) AS
Month,CustomerName,CustomerID,SUM(Revenue*Quantity) AS Revenue
FROM rev
GROUP BY Year, Month
ORDER BY Year,Month,CustomerID
A table with this data:
++--++--
13 matches
Mail list logo