Hi!

I need to use SQL to count some sequences.  We have taken a short snapshot of 1 
year for people registered in programs.  So we have data in a table like so:

ID m1 m2 m3 m4 m5 m6 m7m8 m9 m10 m11 m12

The "m1", "m2", "m3" refers to month 1, month2, month3, etc.

The data for 1 person might look like so:

0023  1 1 1 0 0 2 2 1 1 0 1 0    and there is 1 row for each person.

The "1" means that they were in a program called "SW" and the "2" means "Other" 
and the 0 means "Not in any program".

My problem is to count durations for each person, by program, and get average 
stays in program 1 and in program 2.

Is there a nice way to do this with SQL?   

Thanks heaps!

-Alex

Reply via email to