Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Help with Sql query(Select)

Posted on 2009-07-11
2
Medium Priority
?
200 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
I've encountered valid database schemas that do not have a primary key.  For example, I use LogParser from Microsoft to push IIS logs into a SQL database table for processing and analysis.  However, occasionally due to user error or a scheduled task…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

610 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