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

x
?
Solved

sql query with criteria

Posted on 2011-09-16
5
Medium Priority
?
337 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 2000 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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
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.
Viewers will learn how the fundamental information of how to create a table.

604 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