Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL-server-2005
Hi,
 
I have a table with the following structure
 
Id(pk),regid,secid,pkid,ad1,ad2,ad3,ip,status,statusdate
 
I want to select rows if it is available on all the given period for example, if i give 11-02-2013 and 17-02-2013, it will retrieve rows, if is available on each date between 11-02-2013 and 17-02-2013.
 
Please help me with the select query
 
regards
Posted 16-Feb-13 22:17pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Use between :
select * from [tablename] where statusdate between '2013-02-11' and '2013-02-17'
  Permalink  
Comments
Ahamed Azeem at 17-Feb-13 3:24am
   
Hi Mehdi,
 
it will select all the rows, i know this but I want to select rows only if is available on each date between 11-02-2013 and 17-02-2013.
Mehdi Gholam at 17-Feb-13 3:25am
   
Your comment makes no sense, explain more.
Ahamed Azeem at 17-Feb-13 3:25am
   
i want to if the particular IP is available on all the each date between 11-02-2013 to 17-02-2013
 
Hope you got my point
Mehdi Gholam at 17-Feb-13 3:27am
   
... where ip = 'xxxxx' and statusdate between ...
Ahamed Azeem at 17-Feb-13 3:29am
   
I want to group the rows by IP if its available on each date beween 11-02-2013 and 17-02-2013, I wont give ip as the parameter but only the date. It should not retrive the row if its available on one day and not in another day.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 7,853
1 Sergey Alexandrovich Kryukov 7,107
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,790


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 17 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100