[Babase] (hopefully easy) request for Karl

Susan Alberts babase@www.eco.princeton.edu
Thu, 10 Mar 2005 13:02:31 -0500


Hi Karl,

A quick question about SQL, we hope that this is an easy one for you 
to answer, it is quite simple in principle but we just don't know the 
sql command to use. We are querying babase babase and trying to 
construct a table that has a new field that is essentially an index 
or running count of cases.

For instance, the first field in the output table is a list of males, e.g.,

MaleA
MaleB
MaleC
MaleD
MaleA
MaleB

The second field in the output table is the kid who they are 
potential fathers for, e.g.,

KidA
KidA
KidA
KidA
KidB
KidB

I.e., the first four males in the first field are males that were 
potential fathers for kidA, the next two males were potential fathers 
for KidB. Each Kid has multiple potential fathers.

The third field, which we want to create, is a running count of the 
males for each kid, e.g.,

1
2
3
4
1
2

We don't want a simple count grouped by kid, we want an index or running count.

Is there a simple way to do this that you can tell us about?

Thanks,
Susan

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Susan Alberts, Associate Professor
Department of Biology, Duke University, Box 90338, Durham NC 27708
phone 919-660-7272  fax 919-660-7293