Hello, 

I've wrote a dbproc which gets back a cursor to make an analysis from my
database, now I wanted to add a line to my where-clauses and ran into error
1117 ("Too complicated trigger qualification"). 
I have to get back a table where in the first column (c1) is a result of a
count and in the second column I need (c1/count(something) to get back a
number expressed as a percentage. At the moment I need for such rows in one
table, so I've implemented it through a union select 
At the moment I'm doing it as followed:

CREATE DBPROC SP_db_analysis (IN var1 Smallint, IN var2 DATE, IN var3 DATE,
IN var4 CHAR(2), IN var5 CHAR(2))
RETURNS CURSOR AS
$CURSOR = 'db_analysis_Cursor';
DECLARE :$cursor CURSOR FOR
Select result.t1, result.t1/result2.t2*100 from 
   (Select count(foo) AS t1 FROM... WHERE...) result,
   (Select count(bar) AS t2 FROM... WHERE...) result2

union

Select result3.t3, result3.t3/result2.t2*100 from 
   (Select count(foobar) AS t3 FROM... WHERE...) result3,
   (Select count(bar) AS t2 FROM... WHERE...) result2
 
union 
....

There are 5 Select-Statements which are connected through a union and in
every statement result2.t2 is the same. Can anyone tell me, how can I
simplify these analysis to avoid the too complicated trigger qualification,
if I add my line to the where clauses, which I need so badly.

I don't know if I explained my problem well, but it's much more difficult to
describe than I thought.

Thanks in advance for any help
Peter

-- 
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to