Hi Gavin,

To me it looks like you have to do QoQ on "stuff" and select distinct employeeID. Results will be used for outer loop, instead of original "stuff".

Cheers,
Dmitry.


On August 27, 2014 5:55:18 PM Gavin Baumanis <gavinbauma...@gmail.com> wrote:

Hi Everyone,

I am having  one of those days when I just can't think creatively and would
like to ask for some help, please.

I realise what I am doing wrong... what I don't have is a sense of how to
do it correctly.
Please, let me give you the details in pseudo-code...

query "stuff" //gets lots of rows
loop stuff
    employeeid =  stuff.employeeid[i]
    qoq = query of queries from "stuff" all rows that have stuff.employeeid
= employeeid
               qoq also includes a sythetic column of max(date) as maxDate
                    so all rows of an employee have the same maxDate value
    loop qoq
        update a different table with a subset of qoq
        do stuff based on employee with aggregated employee data


So assuming I have 3 rows of id 20,
I do something like;

update other table
set
    columna = qoq.columnA[i],
    -- " --   B = qoq.columnB[i],
    ....
    newDate = maxdate


So the issue I have is that for each of the 3 instances of employeeid = 20
in STUFF, I do 3 updates
What I really want is just to do 1 set of updates per employeeid.
How do I exclude the 2nd and 3rd lot of updates? (in my example of
employeeid appearing 3 times in STUFF?

Obviously it gets worse - the more times a single employee appears in the
initial resultset!


As always thanks!
Gavin.



--
You received this message because you are subscribed to the Google Groups "cfaussie" group. To unsubscribe from this group and stop receiving emails from it, send an email to cfaussie+unsubscr...@googlegroups.com.
To post to this group, send email to cfaussie@googlegroups.com.
Visit this group at http://groups.google.com/group/cfaussie.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cfaussie+unsubscr...@googlegroups.com.
To post to this group, send email to cfaussie@googlegroups.com.
Visit this group at http://groups.google.com/group/cfaussie.
For more options, visit https://groups.google.com/d/optout.

Reply via email to