Solved

Help with Sql query(Select)

Posted on 2009-07-11
2
172 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

by Mark Wills PIVOT is a great facility and solves many an EAV (Entity - Attribute - Value) type transformation where we need the information held as data within a column to become columns in their own right. Now, in some cases that is relatively…
So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What ‚Ķ
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

919 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now