Wednesday 15 August 2012

sql server - Data between two dates using where condition -


I'am using a stored procedure to obtain values ​​between the data used in such a situation) .

For example, I have a table with the column

  Username User ID date_used Book name xxxx UID001 12-03-2012 zzzzz yyyy UID 002 14-03-2015 Ccccc xxxx UID001 14-03-2015 rrrrr  

Put the desired out

  Username User ID date_used Book name xxxx UID001 12-03-2012 zzzzz xxxx UID001 14-03-2015 rrrrr  

For this, I tried below, please help me where I am wrong

  SELECT UserID, Issue_Date, Book_Name Dbo.Books where UserID = @USERID and Issue_Date & gt; = @ Frame and Issue_ Date & lt; = @ Issue_Date Desc @from (datetime) and @to (datetime) Ditetime value (start date and end date) @ User id varchar 

When I remove the UserID segment I was able to retract all the books, filed lawsuits for all users, but when I do not reflect any of the lines of user ID, I connect to it.

Please advise me in other ways to do this.


No comments:

Post a Comment