Skip site navigation (1) Skip section navigation (2)

SQL Question

From: "Kevin Crenshaw" <kcrenshaw(at)viscient(dot)com>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: SQL Question
Date: 2006-02-22 14:43:09
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
I have a table called 'tasks' with a structure like this:
Taskid            ParentId
1                                                                    null
2                                                                    1
3                                                                    1
4                                                                    Null
5                                                                    4
6                                                                    4
7                                                                    Null
8                                                                    Null
9                                                                    15
10                                                                18
The taskid column is the primary key and the parentid column references
values in the taskid column.  However, it is possible for the parentid to be
a value that is not found in the taskid column (hence my question.).  I need
to write a query that will retrieve all rows where the parentid is either
'null' or does not exist in the taskid column.
Any help would really be appreciated.


pgsql-novice by date

Next:From: Charley TiggsDate: 2006-02-22 14:56:27
Subject: Re: drop index
Previous:From: Jaromír KamlerDate: 2006-02-22 13:56:54
Subject: drop index

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group