jeudi 5 novembre 2015

Find out the particular data which has only given condition

Vote count: 0

I have a table like this in SQL SERVER


Name    ID  StartDate   EndDate
James   232   2005       2015
James   232   2001       2006
Joe     600   1982       2005
Lord    608   2003       2005
Lord    608   2006       2012
Lord    608   1999       2004
Lee     122   2001       2003
Lee     122   2002       2006

Condition is I need the name whose startdate is equal or less than 2005 AND Enddate is equal or Greater than 2005

So the output like this


Name    ID  StartDate   EndDate
James   232    2005       2015
James   232    2001       2006
Joe     600    1982       2005

I use Subquery for this but the result Include this also

Lord    608 2003    2005
Lord    608 1999    2004
 Lee    122 2002    2006 

But i don't want this record

asked 26 secs ago

This entry passed through the Full-Text RSS service - if this is your content and you're reading it on someone else's site, please read the FAQ at http://ift.tt/jcXqJW.



Find out the particular data which has only given condition

Aucun commentaire:

Enregistrer un commentaire