SQL error when accessing database..

Unanswered Question
Oct 15th, 2009

Im using this sql select for retrieving som historical data :

select CSQ, sum(kaldIalt), sum(KaldTabt) from DEV_CSQR where Dato between '09/1/09' and '10/31/09' group by CSQ

When testing it - it returns 17 rows - working as designed.

when debugged, the DB Read works fine,

but the first DB get, throws a SQL error.

I think it's because of the sum.

Are there any way to get it working, without dropping the sum.



I have this problem too.
0 votes
  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 3 (1 ratings)

It is because of the SUM. If I recall correctly, the DB Get can only work on columns - be they in tables or in table views. I first encountered this when I wanted to return COUNT (*) to get the number of rows in a database matching X. There may be a workaround for that by now.

In your case, you may have to write a Java class that does the business. I prefer that method and don't use the DB steps, as it gives much more control over the results returning, complex SQL and stored procedure calls - but I'm a programmer.




This Discussion