Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 query problem

Author  Topic 

rdl
Starting Member

25 Posts

Posted - 2011-05-18 : 20:26:57
Hi,
I am doing the following query:

Select
Z.*
FROM
( Select *
FROM personalert A
WHERE A.PRelation = 'Missing'
AND NOT EXISTS(
SELECT *
FROM personalert B
WHERE B.ID = A.ID
AND B.PRelation = 'Found'
AND B.PDate > A.PDate
)
) Z
INNER JOIN person C
on Z.ID = C.ID";

Query is working in showing the first part till the B.Pdate > A.Date...however it is not showing the fields names from the person table.. I just need the person.Surname and person.Name which is connected by fieldname ID in personalert table...

can someone tell me wher I'm wrong please...

Thanks a lot for your precious help

X002548
Not Just a Number

15586 Posts

Posted - 2011-05-18 : 20:28:26
Corey..this is your fault...



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

rdl
Starting Member

25 Posts

Posted - 2011-05-18 : 20:34:19
The other query in my previous thread worked ok...but this one....can't show the name and suranme from the person table!!
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-05-18 : 20:39:54
See the Hint in X002548 thread.


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -