Solved

Help with Sql query(Select)

Posted on 2009-07-11
2
175 Views
Last Modified: 2012-05-07
Hi Experts,
I have written following query,
select v.village_name,s.new_survey_no from tbSurvey s inner join tbLACase lc on s.lac_no = lc.lac_no
inner join tbVillage v on v.village_id = s.village_id where lc.lac_no = '1/A-65/1998-99'

Now there is a column 'possession_date' in tbSurvey.In the above query,I want to show possession_status.
If possession_date is entered in the tbSurvey for that new_survey_no,I want to show 'Yes' else 'No'

How to do this?
0
Comment
Question by:johny_bravo1
2 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 24833519
simple case expression:
select v.village_name,s.new_survey_no 
, CASE WHEN s.possession_date IS NULL THEN 'No' ELSE 'Yes' END as possession_status
from tbSurvey s inner join tbLACase lc on s.lac_no = lc.lac_no 
inner join tbVillage v on v.village_id = s.village_id where lc.lac_no = '1/A-65/1998-99'

Open in new window

0
 
LVL 8

Author Closing Comment

by:johny_bravo1
ID: 31602536
Thanks
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need help with a query 3 48
configure service broker on all databases 2 83
Error when saving to sql table a '/' 5 28
TSQL mapping detailed records to group records 9 53
INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question