Date index for Jan 2002


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SQL ERROR in Employee Week Report



Hi List,

i think i postet a similar error before in: >>[achievo] Possible Bug in SQL-Query<<
it deals with the problem of postgre to handel the SUM(x) in the SELECT statemennt.
in postgre you must have every SELECTed field in the GROUP statement when you want to use SUM(x) (not very comfortable :( )


here is the errormessage from pgsql

>psql -e achievo
[...]
achievo=# SELECT sum(time) as time,
activitydate, hours.userid, employee.name
FROM hours, employee
WHERE hours.userid ='t.henle'
AND activitydate >= '2002-01-01'
AND activitydate <= '2002-01-08'
AND hours.userid = employee.userid
GROUP BY hours.userid, activitydate;
[...]
ERROR: Attribute employee.name must be GROUPed or used in an aggregate function
achievo=# SELECT sum(time) as time,
activitydate, hours.userid, employee.name
FROM hours, employee
WHERE hours.userid ='t.henle'
AND activitydate >= '2002-01-01'
AND activitydate <= '2002-01-08'
AND hours.userid = employee.userid
GROUP BY hours.userid, activitydate, employee.name;
[...] ^^^^^^^^^^^^^
WORKS!


i don't know wether this changes something in the programm logic or not!
but if it don't you can fix this easiely.

cu (mit freundlichen Grüßen)

-Tobias Henle

ps: sorry but my english is not so good :(
                         _   _    _
 __ __ ____ __ ____ __ _| |_| |_ (_)___ ___ ___ _ _    __ ___ _ __
 \ V  V /\ V  V /\ V  V /  _| ' \| / -_|_-</ -_) ' \ _/ _/ _ \ '  \
  \_/\_/  \_/\_/  \_/\_(_)__|_||_|_\___/__/\___|_||_(_)__\___/_|_|_|
--
________E-Mail________________________URL____________________________
	blank achievo 0.6.5

  • Next by Date: Re: [achievo] blank achievo 0.6.5
  • Previous by thread: Re: [achievo] blank achievo 0.6.5
  • Next by thread: Fatal error
  • Index(es):
  • http://www.achievo.org/lists achievo.org - ©1999-2002 ibuildings.nl BV