Home All Groups Group Topic Archive Search About
Author
25 Nov 2005 8:39 PM
W.Meints
I am trying to get an overview of non-planned items using the following query:

SELECT     dbo.ProjectTasks.TaskId
FROM         dbo.ProjectTasks INNER JOIN
                      dbo.PlannedItems ON dbo.ProjectTasks.TaskId <>
dbo.PlannedItems.TaskId

The query should select those records from ProjectTasks which dont have a
matching record in the PlannedItems table. This works ok, when you have one
or more planneditems and some projecttasks. But if you dont have any
planneditems you get an empty result.

Anybody know what the problem is with this query?
--
Best regards,

W.Meints

Author
25 Nov 2005 8:46 PM
Raymond D'Anjou
SELECT    PT.TaskId
FROM         dbo.ProjectTasks PT
WHERE NOT EXISTS (SELECT * FROM dbo.PlannedItems WHERE
dbo.PlannedItems.TaskId  = pt.TaskId)

Show quote
"W.Meints" <W.Meints@newsgroups.nospam> wrote in message
news:193D48B2-C8B3-4937-917C-488B15B1DED3@microsoft.com...
>I am trying to get an overview of non-planned items using the following
>query:
>
> SELECT     dbo.ProjectTasks.TaskId
> FROM         dbo.ProjectTasks INNER JOIN
>                      dbo.PlannedItems ON dbo.ProjectTasks.TaskId <>
> dbo.PlannedItems.TaskId
>
> The query should select those records from ProjectTasks which dont have a
> matching record in the PlannedItems table. This works ok, when you have
> one
> or more planneditems and some projecttasks. But if you dont have any
> planneditems you get an empty result.
>
> Anybody know what the problem is with this query?
> --
> Best regards,
>
> W.Meints
Author
26 Nov 2005 6:59 PM
W.Meints
Thanks for the help Raymond, that worked out great.
--
Best regards,

W.Meints


Show quote
"Raymond D'Anjou" wrote:

> SELECT    PT.TaskId
> FROM         dbo.ProjectTasks PT
> WHERE NOT EXISTS (SELECT * FROM dbo.PlannedItems WHERE
> dbo.PlannedItems.TaskId  = pt.TaskId)
>
> "W.Meints" <W.Meints@newsgroups.nospam> wrote in message
> news:193D48B2-C8B3-4937-917C-488B15B1DED3@microsoft.com...
> >I am trying to get an overview of non-planned items using the following
> >query:
> >
> > SELECT     dbo.ProjectTasks.TaskId
> > FROM         dbo.ProjectTasks INNER JOIN
> >                      dbo.PlannedItems ON dbo.ProjectTasks.TaskId <>
> > dbo.PlannedItems.TaskId
> >
> > The query should select those records from ProjectTasks which dont have a
> > matching record in the PlannedItems table. This works ok, when you have
> > one
> > or more planneditems and some projecttasks. But if you dont have any
> > planneditems you get an empty result.
> >
> > Anybody know what the problem is with this query?
> > --
> > Best regards,
> >
> > W.Meints
>
>
>

AddThis Social Bookmark Button