Re: Problems with set_sql and iterators

[prev] [thread] [next] [Date index for 2005/06/20]

From: Tony Bowden
Subject: Re: Problems with set_sql and iterators
Date: 08:29 on 20 Jun 2005
On Mon, Jun 20, 2005 at 05:50:52PM +1000, Jacinta Richardson wrote:
> 	# Declare our primary key field(s)
> 	__PACKAGE__->columns(Primary => 'StaffID', 'ProjectName', 
> 	'Allocation');
> 	__PACKAGE__->columns(TEMP => 'Total');
> 	# Select total time allocated to each project
> 	Staff::Projects->set_sql(total_times =>
>         	"SELECT ProjectName, sum(Allocation) as Total
>         	 FROM Projects
>         	 GROUP BY ProjectName
>         	 ORDER BY ProjectName"
> 	);

As you say, it's a PK issue. As you're grouping by ProjectName, surely
you should be declaring that as the sole PK?

If you need to use this class to access this table in its 'normal' form
elsewhere, then turn this version of it into a different class (think of
it as a cheap VIEW) that can have ProjectName as a single PK.

Tony

(message missing)

Problems with set_sql and iterators
Jacinta Richardson 07:50 on 20 Jun 2005

Re: Problems with set_sql and iterators
Tony Bowden 08:29 on 20 Jun 2005

Re: Problems with set_sql and iterators
Jacinta Richardson 09:01 on 20 Jun 2005

Re: Problems with set_sql and iterators
merlyn (Randal L. Schwartz) 10:13 on 20 Jun 2005

Re: Problems with set_sql and iterators
Jacinta Richardson 11:44 on 20 Jun 2005

Re: Problems with set_sql and iterators
William Ross 12:51 on 20 Jun 2005

Re: Problems with set_sql and iterators
Michael Peters 13:30 on 20 Jun 2005

Re: Problems with set_sql and iterators
Jacinta Richardson 00:37 on 21 Jun 2005

Re: Problems with set_sql and iterators
Tony Bowden 13:57 on 20 Jun 2005

Generated at 16:37 on 28 Jul 2005 by mariachi v0.52