Results 1 to 1 of 1
  1. #1
    Join Date
    Oct 2004
    Location
    Paris, FRANCE
    Posts
    132

    Post Unanswered: Finding Empty JOIN records

    I'm trying to find broken links between two tables.
    Performing that I can view all the links
    Code:
    SELECT
    	t2.name AS "object",
    	t1.name AS "group"
    FROM
    	t2
    	LEFT JOIN t1 ON (t1.t1_id = t2.t1_id)
    I get get something like that
    Code:
    +---------+-----------+
    | object  | group     |
    +---------+-----------+
    | apple   | food      |
    | bus     | vehicule  |
    | car     | vehicule  |
    | chair   | furniture |
    | cheese  | food      |
    | coat    | cloth     |
    | metro   | vehicule  |
    | noze    |           |
    | table   | furniture |
    | water   |           |
    | window  |           |
    | wine    |           |
    +---------+-----------+
    But i'm trying to get only the broken ones (objects having no group)
    Code:
    SELECT
    	t2.name AS "object",
    	t1.name AS "group"
    FROM
    	t2
    	LEFT JOIN t1 ON (t1.t1_id = t2.t1_id)
    WHERE
    	t1.name = NULL
    I'd like to get
    Code:
    +---------+-----------+
    | object  | group     |
    +---------+-----------+
    | noze    |           |
    | water   |           |
    | window  |           |
    | wine    |           |
    +---------+-----------+
    But this one gives me an empty result
    Last edited by gtk; 09-26-05 at 08:09.

Posting Permissions

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