Click here to Skip to main content
15,881,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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

1 solution

Use between :
SQL
select * from [tablename] where statusdate between '2013-02-11' and '2013-02-17'
 
Share this answer
 
Comments
Ahamed Azeem 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 17-Feb-13 3:25am    
Your comment makes no sense, explain more.
Ahamed Azeem 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 17-Feb-13 3:27am    
... where ip = 'xxxxx' and statusdate between ...
Ahamed Azeem 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900