Solved

sql query with criteria

Posted on 2011-09-16
5
328 Views
Last Modified: 2012-06-27
Hi,

Cheers
0
Comment
Question by:RIAS
[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
  • 3
5 Comments
 
LVL 31

Expert Comment

by:James Murrell
ID: 36550035
http://www.sql-tutorial.net/ may help but as you didn't post a question it would be impossible to provide answer
0
 

Author Comment

by:RIAS
ID: 36550055
Sorry the query is :
How do I write a sql query for--
Select *  From Personal_Details  Where  Status at Input_Date  = Activeor Preserved Pensioner or Pensioner or  Widow  or Child
OR where  Status at Input_Date  = No Liability
and  Dateleft,Dbdate, Pdpencomm or Topaid later than Input_Date less 1 Year

Cheers
0
 

Author Comment

by:RIAS
ID: 36550075
I tried attaching the query in code but it didnt get updated.Sorry about that.
0
 
LVL 7

Accepted Solution

by:
twol earned 500 total points
ID: 36550219
Select *  From Personal_Details  
Where  
(([Status at Input_Date]  in ('Active','PreservedPensioner','Pensioner','Widow','Child'))
OR ([Status at Input_Date]  = 'No Liability')
)
and  (Dateleft > dateadd(y,Input_date,-1)
or Dbdate > dateadd(y,Input_date,-1)
or Pdpencomm  > dateadd(y,Input_date,-1)
or Topaid > dateadd(y,Input_date,-1))

0
 

Author Closing Comment

by:RIAS
ID: 36553862
Cheers mate!!
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

717 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