Help with join, delete

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike

    #1

    Help with join, delete

    I am not a sql person and could use some help with a delete...here is
    what I want:

    I have the following tables/fields (only including necessary fields)

    answers
    result_id

    results
    result_id
    points

    I want to delete the records for result_id from both tables when
    points in the results table <50

    Thanks in advance for any assistance.

    Mike
  • Aggro

    #2
    Re: Help with join, delete

    Mike wrote:
    [color=blue]
    > I have the following tables/fields (only including necessary fields)
    >
    > answers
    > result_id
    >
    > results
    > result_id
    > points
    >
    > I want to delete the records for result_id from both tables when
    > points in the results table <50[/color]

    This might help:
    http://dev.mysql.com/doc/mysql/en/DELETE.html

    But please note the part saying:
    "From MySQL 4.0, you can specify multiple tables in the DELETE statement
    to delete rows from one or more tables depending on a particular
    condition in multiple tables. However, you cannot use ORDER BY or LIMIT
    in a multiple-table DELETE.

    The first multiple-table DELETE syntax is supported starting from MySQL
    4.0.0. The second is supported starting from MySQL 4.0.2. The
    table_reference s part lists the tables involved in the join. Its syntax
    is described in section 14.1.7.1 JOIN Syntax. "

    Comment

    Working...