CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 GROUP BY and error message

Print topic Send  topic

Author Message
Rene
Posted: 09/19/2002, 1:52 PM

Hi,

I use ASP and Templates, CCS 1.07, XP pro, IIS

I've got a table called "kleurnrs"
In it are 5 fields: kleurnrs,kleurtkst,typ,hoofdgroep_Id,kleurnrs_Id
I'v set data source type to SQL.
SQL statement: SELECT kleurnrs, kleurtkst, typ
FROM kleurnrs
WHERE hoofdgroep_Id = hoofdgroep_Id
GROUP BY typ

I get the following message after I test the statement (I'll try in english): You are trying to execute a query where the given expression kleurnrs takes no part of a statistical function. (in dutch: u probeert een query uit te voeren waarbij de opgegeven expressie kleurns geen deel uitmaakt van een statistische functie.) Can anyone help me how to correct this syntax?

Thanks,

Rene


Steve
Posted: 09/19/2002, 2:08 PM

Hi Rene

If you use a Group By clause, the only things which may appear in the select list are fields which are grouped, or aggregate functions (such as sum, count, etc - ie functions which aggregate values)

e.g. Select count(a), b from tablec group by b is fine
Select count(a), b, c from tablec group by b is not, because c is neither an aggregate nor a grouped field.

In the second example above, if there were two rows as follows:

a=1,b=2,c=3
a=1,b=2,c=4

if you grouped on b, which value of c would you expect to see? See what I mean?

Hope this helps.
eDuck
Posted: 09/19/2002, 3:26 PM

Why are you setting hoofdgroep_Id equal to itself?
Rene
Posted: 09/20/2002, 12:47 AM

Hi,

First of all, thanks for your replies!

What I'm trying to achieve is as follows:

a=1,b=1,c=1
a=2,b=2,c=1
a=3,b=3,c=2
a=4,b=4,c=2

These values a want displayed as:
c1,a1,b1
a2,b2
c2,a3,b3
a4,b4

How can I achieve this, please keep in mind that I'm a non programmer but trying hard to learn.

Thanks alot,

Rene




   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.