Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2005
    Posts
    2

    Unanswered: Recursion in MySQL

    How can I fetch recursive data from two seperate tables using single mysql 5 query (without using stored procedures)?
    See Example attached (as image), how a source has multiple notes and notes can have multiple sources:

    This event has a source and two notes. The source (Book of Tel Aviv Memorials in this case) and there is a note on that source (This is a great book) and a source on that note (Interview with George Singh). There are also one note on the source - Interview with George Singh (Note: It isn't certain that he was really born in 1928), which further has source related to it (Source: [+] Interview with Jeremiah Quizzle)
    Attached Thumbnails Attached Thumbnails recursion.jpg  
    Last edited by gurpreets; 10-04-05 at 11:11.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by gurpreets
    How can I fetch recursive data from two seperate tables using single mysql 5 query (without using stored procedures)?
    unless you can hard-code the maximum number of self-joins (i.e. the tree has a maximum depth), you can't do this with one query
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •