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
 Regarding pending question display

Author  Topic 

esambath
Yak Posting Veteran

89 Posts

Posted - 2009-06-22 : 10:38:19
Hi expert,

please help this query

I have two table LP_AskaQuestion and LP_Answer

LP_AskaQuestion

AskaQuestionId Question
1 What is asp?
2 What is php?
3 what is java?
LP_Answer

AnswerId AskaQuestionId Answer
1 1 Active server page

output (To display the pending question)

AskaQuestionId Question
2 what is php?
3 what is java?

Thanks an Advance

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2009-06-22 : 10:43:28
SELECT a.AskaQuestionId, a.Question
from LP_AskaQuestion a LEFT JOIN LP_Answer b
on a.AskaQuestionId = b.AskaQuestionId
WHERE b.AskaQuestionId IS NULL
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-06-22 : 10:48:27
[code]SELECT *
FROM LP_AskaQuestion q
WHERE NOT EXISTS (SELECT 1 FROM LP_Answer WHERE AskaQuestionId=q.AskaQuestionId)
[/code]
Go to Top of Page
   

- Advertisement -