Subject | Re: [firebird-support] Joining table in UPDATE statement? |
---|---|
Author | Nando Dessena |
Post date | 2006-11-21T16:42:15Z |
Ann,
A> UPDATE Students
A> SET Mentor = I.Name
A> FROM Students S
A> INNER JOIN Registrations T ON S.Id = R.StudentId
A> INNER JOINT Instructors I ON R.InstructorId = I.Id
A> The join will produce one name for each course the student takes.
A> Which one is meant to be the mentor?
no one. A run time error should be thrown, much like when you are required to
use a singleton select and you don't. That's what databases which
support this useful (although admittedly ugly) extension do, AFAIK.
A> The standard update, ugly as it is, requires that each of the
A> sources for the assignment return a single value.
which is perfectly sensible, but it could be checked at run time.
Ciao
--
Nando Dessena
======================================================
I support Firebird, I am a Firebird Foundation member!
Join today at http://www.firebirdsql.org/ff/foundation
======================================================
A> UPDATE Students
A> SET Mentor = I.Name
A> FROM Students S
A> INNER JOIN Registrations T ON S.Id = R.StudentId
A> INNER JOINT Instructors I ON R.InstructorId = I.Id
A> The join will produce one name for each course the student takes.
A> Which one is meant to be the mentor?
no one. A run time error should be thrown, much like when you are required to
use a singleton select and you don't. That's what databases which
support this useful (although admittedly ugly) extension do, AFAIK.
A> The standard update, ugly as it is, requires that each of the
A> sources for the assignment return a single value.
which is perfectly sensible, but it could be checked at run time.
Ciao
--
Nando Dessena
======================================================
I support Firebird, I am a Firebird Foundation member!
Join today at http://www.firebirdsql.org/ff/foundation
======================================================