Sep 25
Patrick Larkin OT: Tricky SQL
Sep 25, 2013; 14:27
Patrick Larkin
OT: Tricky SQL
Hello - Wondering if someone on the list could point me in some direction on how to write this query:
Is it possible to consruct a SQL to take a table like below and write a single
distinct record for each STUDENT and "TEACHER"?
STUDENT TEACHER START END
Joe Edgar Winter 2013-08-29 2013-11-30
Joe Leslie West 2013-11-01 2014-03-23
Joe Edgar Winter 2014-03-24 2014-07-01
Sue Jack Bruce 2013-08-29 2013-07-01
Tim Leslie West 2013-11-07 2014-01-13
Tim Edgar Winter 2014-01-14 2014-07-01
Lou Robin Trower 2013-08-29 2013-09-30
Lou Leslie West 2013-10-01 2014-05-17
Lou Robin Trower 2014-05-18 2014-07-01
In this case, I'd want the output to show the earliest start date and latest end date per person per teacher:
Joe Edgar Winter 2013-08-29 2014-07-01
Joe Leslie West 2013-11-01 2013-03-23
Sue Jack Bruce 2013-08-29 2013-07-01
Tim Leslie West 2013-11-07 2014-01-13
Tim Edgar Winter 2014-01-14 2014-07-01
Lou Robin Trower 2013-08-29 2014-07-01
Lou Leslie West 2013-10-01 2014-05-17
So "Joe" has three records in the table but his results would only show two
because he only had two guitar teachers.
Sue has one record in the table and one record output.
Tim has two records (two guitar teachers) and two records output.
Lou has three records in the table but output is two records because he only
had two guitar teachers.
#############################################################
This message is sent to you because you are subscribed to
the mailing list Lasso
Lasso@lists.lassosoft.com
To unsubscribe, E-mail to: <Lasso-unsubscribe@lists.lassosoft.com>
Send administrative queries to <Lasso-request@lists.lassosoft.com>
Sep 25
Ke Carlton Re: OT: Tricky SQL
Sep 25, 2013; 19:28
Ke Carlton
Re: OT: Tricky SQL
Sep 25
Patrick Larkin Re: OT: Tricky SQL
Sep 25, 2013; 15:03
Patrick Larkin
Re: OT: Tricky SQL
Oct 01
Patrick Larkin Re: OT: Tricky SQL
Oct 01, 2013; 10:34
Patrick Larkin
Re: OT: Tricky SQL
Oct 01
Patrick Larkin Re: OT: Tricky SQL
Oct 01, 2013; 11:04
Patrick Larkin
Re: OT: Tricky SQL
Oct 02
Tami Williams Re: OT: Tricky SQL
Oct 02, 2013; 02:31
Tami Williams
Re: OT: Tricky SQL