sql server - SQL Date Compare by only using Date not Time -
It was a basic question of how to implement it because I was stuck in a certain part, but now I'm curious Why was this happening in the first place? I did not have to comprehend the time compared to the dates only, which is not a problem, if the bar is no different. The code below I was basically trying to
select a worker involved in e tourist OT_Hours o o.Emp_ID = position P in internal position on e.Emp_ID. Position_ID = e.Position_ID Join the signup_sheet at S.Employee_ID = e.Emp_ID on these where E. Qualified_aut = 1 and s. Di_shift = 1 and p. Position_Name = 'controller' and convert (considered (20), Skdet, 101) = '07 / 26/2010 and convert (Worker (20), Okdet, 101) & lt; = '07/26/2010' and Convert (Worker (20), O.Det, 101) & gt; '07 / 26/200 9 'and Okdeta Diissi
No option will not have any effect on me not by when I run the query, but when I put one out last In line, it returns 12 results (& lt; =) and when I had removed the last last line, but the second last kept, it would return 6 results (>). After reviewing the data, I could see that 4 out of those results should have returned. Now the strongest part is the code below which I am currently using.
Select the difference o.Date, as e.Emp_ID as name Emp_ID, e.First_Name + '' + e.Last_Name, o. O Leave OT_Hours o o.Emp_ID = s.Employee_ID on left.Position_ID = left position p e.Position_ID Sainap_ Sheet s on e.Emp_ID = e.Emp_ID where e.Enable_OT = 1 and s.Day_Shift = 1 and P.Position_Name = 'Controller' and Convert (Worker (20), SD, 101) = '07 / 26/2010 'and '07 / 26/200 9 and '07 / 26/2010' There is no substitute by DESC
(0.3) This result will result, but I also did the test as I did the second when o.Date was up and down the specified date when the date was & Lt; = 16 results were returned when> 8 results were returned the last question produced 6 results. Now this is not a production database against which I am interrogating and I am the only person to use it so that the data do not change. Any explanation on why this is happening? I am assuming that it had to do something to convert to varchar and it can not compare properly, but it does not explain that I am 12 & lt; = 6 will be received and then no result will be found at the end. Apart from this, if anyone knows the better way of implementing it then please tell me.
In the first of the third row, you are comparing two stars in your first query
As 01/02/2009
is greater than 01/01/2010
I usually deselect '01 / Between 02/200 9 00: 00: 00.000 'and '01 / 01/2010 23: 59: 59.997'
would be interesting to see but better solution.
Comments
Post a Comment