Re: Challenging query....

2003-10-17 Thread Director General: NEFACOMP
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 from a query, is there a command or function I can put in a query to add

Challenging query....

2003-10-16 Thread Jeff McKeon
I have a table that contains customer revenue information. REVENUE TABLE: Date, customer name, CustomerID, revenue, quantity I need to create a query that will produce the following result Year, Month, Customer1_rev, customer2_REV, customer3_rev, etc... 2002, 01, 0, $30.00, $15.00

Re: Challenging query....

2003-10-16 Thread Gabriel Ricard
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:

RE: Challenging query....

2003-10-16 Thread Jeff McKeon
| | 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

RE: Challenging query....

2003-10-16 Thread 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

Re: Challenging query....

2003-10-16 Thread Rory McKinley
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: [EMAIL PROTECTED] Sent: Thursday, October 16, 2003 4:21 PM Subject: Challenging query I have a table

RE: Challenging query....

2003-10-16 Thread Jeff McKeon
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

Re: Challenging query....

2003-10-16 Thread Rory McKinley
don't (Unknown) - Original Message - From: Jeff McKeon [EMAIL PROTECTED] To: Rory McKinley [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, October 16, 2003 6:51 PM Subject: RE: Challenging query If you have a way to generate the query code dynamically (e.g. using a loop in C

RE: Challenging query....

2003-10-16 Thread Diana Soares
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 returned?

Re: Challenging query....

2003-10-16 Thread Gabriel Ricard
understand binary and those who don't (Unknown) - Original Message - From: Jeff McKeon [EMAIL PROTECTED] To: Rory McKinley [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, October 16, 2003 6:51 PM Subject: RE: Challenging query If you have a way to generate the query code dynamically

RE: Challenging query....

2003-10-16 Thread Jeff McKeon
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; [EMAIL PROTECTED] Subject: Re: Challenging query Or you could just do one simply query

Re: Challenging query....

2003-10-16 Thread Gabriel Ricard
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; [EMAIL PROTECTED] Subject: Re: Challenging query Or you could just do one

RE: Challenging query....

2003-10-16 Thread Jeff McKeon
:[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 query: SELECT YEAR(TheDate) AS Year,MONTH(TheDate) AS Month,CustomerName

Re: Challenging query....

2003-10-16 Thread Gabriel Ricard
. 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 query: SELECT YEAR(TheDate