Aaron Freeman
2004-04-20 14:47:06 UTC
(1) Is there a debug flag somewhere that dump all SQL queries to the
console?
(2) How are nested joins accomplished?
For example, in the AuthorBooks schema, lets assume there is another table
called publisher that has a 1-M relationship with books, like so (sorry
about the formatting):
............................................................................
.............
.+-----------+.(0,1)..............(0,*).+-------+.(0,*)..............(0,1).+
-----------+.
.|..Writer...|<-author----------books->>|.Book..|<<-books-------publisher->|
.Publisher.|.
.|-----------|.(nullify)......(cascade).|-------|..........................|
-----------|.
.|.lastName..|..........................|.title.|..........................|
.bizName...|.
.|.firstName.|..........................|.price.|..........................|
.location..|.
.|.age.......|.(0,1)....................+-------+..........................+
-----------+.
.|.birthday..|<-pygmalion--+................................................
.............
.+-----------+.(nullify)...|................................................
.............
.....|....................|.................................................
............
......+--------------------+................................................
.............
............................................................................
.............
How would I get writers by publisher?
More specifically, is there an elegant way to do a nested join in a single
query, or do I just have to do a single writer-book join and then iterate
over the resultset for the second join?
Code examples would be great!
Thanks for your time.
-Aaron
console?
(2) How are nested joins accomplished?
For example, in the AuthorBooks schema, lets assume there is another table
called publisher that has a 1-M relationship with books, like so (sorry
about the formatting):
............................................................................
.............
.+-----------+.(0,1)..............(0,*).+-------+.(0,*)..............(0,1).+
-----------+.
.|..Writer...|<-author----------books->>|.Book..|<<-books-------publisher->|
.Publisher.|.
.|-----------|.(nullify)......(cascade).|-------|..........................|
-----------|.
.|.lastName..|..........................|.title.|..........................|
.bizName...|.
.|.firstName.|..........................|.price.|..........................|
.location..|.
.|.age.......|.(0,1)....................+-------+..........................+
-----------+.
.|.birthday..|<-pygmalion--+................................................
.............
.+-----------+.(nullify)...|................................................
.............
.....|....................|.................................................
............
......+--------------------+................................................
.............
............................................................................
.............
How would I get writers by publisher?
More specifically, is there an elegant way to do a nested join in a single
query, or do I just have to do a single writer-book join and then iterate
over the resultset for the second join?
Code examples would be great!
Thanks for your time.
-Aaron