Well, the best solution at that point does not involve a database, but I
appreciate your thoughts.


M

-----Original Message-----
From: Barney Boisvert [mailto:[EMAIL PROTECTED]
Sent: Monday, October 20, 2003 2:41 PM
To: CF-Talk
Subject: RE: MySQL Heirarchies


MySQL 5.0 (in alpha) has stored proc support.  check
http://www.mysql.com/doc/en/Roadmap.html and it's sub-pages for
some info.

You can do that loop using CF, if that suits you:

<cfloop ..>
   <cfquery ... >
      INSERT INTO temp_table ...
      SELECT ....
   </cfloop>
</cfloop>
  -----Original Message-----
  From: Haggerty, Mike [mailto:[EMAIL PROTECTED]
  Sent: Monday, October 20, 2003 11:34 AM
  To: CF-Talk
  Subject: RE: MySQL Heirarchies

  Barney -

  I suspect you are right, and that the real solution is to do
the
  processing on the Web server side.

  The real problem is the lack of recursion in MySQL, and this
issue is
  independent of stored procedures. It would be nice if it was
possible to
  write a query, loop around it, and store intermediate results
in a
  temporary table within the database.

  For the record, does anyone know if control structures such as
this are
  being considered for future releases?

  M

  -----Original Message-----
  From: Barney Boisvert [mailto:[EMAIL PROTECTED]
  Sent: Monday, October 20, 2003 2:26 PM
  To: CF-Talk
  Subject: RE: MySQL Heirarchies

  I don't think you'll be able to do it, because you can't use
  stored
  procedures with MySQL.  You can use a temp table, if you want,
  though.  Just
  run a CREATE TEMPORARY TABLE statement.  However, I suspect
that
  pulling the
  raw recordset back to CF and processing it there will be
faster,
  because
  you're going to have to run a bunch of separate queries
anyway,
  and doing
  QofQ on a recordset is almost exactly equivalent to using a
temp
  table.

  barneyb
    -----Original Message-----
    From: [EMAIL PROTECTED] [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED]
    Sent: Saturday, October 18, 2003 10:47 PM
    To: CF-Talk
    Subject: MySQL Heirarchies

    I am stumped on a MySQL query, it involves returning
  information sorted
  into a heirarchy.

    There's this table with the following fields: item_id,
  parent_id, and
  comment. Item_id is the unique identifier of each record, and
  each record
  can be a child of another. Parent_id reflects this
relationship.

    I need to return a recordset sorted by parent_id, i.e.:

    item_one
    -- item_two
    ---- item_three
    -- item_four
    ---- item_five
    ------ item_six
    -------- item_seven
    item_eight
    -- item_nine
    ---- item_ten

    etc...

    Help! I know how to do this in SQL Server and Oracle using
  temp tables,
  but am not finding the answer in MySQL.

    M

    _____


  _____  


[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to