Solved

sql query with criteria

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

Cheers
0
Comment
Question by:RIAS
  • 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how the fundamental information of how to create a table.

910 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

24 Experts available now in Live!

Get 1:1 Help Now