Page 1 of 1

special table output!!!

Posted: Wed Nov 23, 2005 11:44 pm
by joecrack
Hai
i want to build a table output that is ordered like this:
http://rzserv2.fhnon.de/~lg016500/untitled1.bmp
(the <10, <100 etc is just an example - i want it to be seperatet by different dates)
I want to fill out the blanks, but i dont know how i have to do the SELECTs.
It could be done like this:

Code: Select all

SELECT sum(tovalue)  from sam_date_val group by actdeldate BETWEEN DATE '2003-01-01' AND DATE '2005-08-08' AND actdeldate BETWEEN DATE '2005-09-09'AND DATE '2015-08-08'
But i just get one output that i want. I just get one output, but i want to have a new collum with the second date select. Is it possible to make a SELECT for every row???
joe

Posted: Thu Nov 24, 2005 2:38 am
by joecrack
so now i got a sql command like this:

Code: Select all

SELECT 
   sum(tovalue) 
FROM 
   sam_date_val 
GROUP BY 
   contrdate 
BETWEEN 
   DATE '$year-01-01'
   AND 
   DATE '$year-01-31', contrdate 
BETWEEN 
   DATE '$year-02-01'
   AND 
   DATE '$year-02-30', contrdate 
BETWEEN 
   DATE 
...................
But it makes a new rows for every group .. and i want it all to be in onerow!?!
AND i still have to group t, means if i do it like this, i still have to make at least two more SELECTS!!!

Posted: Thu Nov 24, 2005 11:17 am
by John Cartwright
I've modified your query to be readable by humans... next time please do the same.

Posted: Sun Nov 27, 2005 11:55 pm
by joecrack
plz somebody ...
just some approach ....