Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
12 votes
3 answers
780 views

Are these two queries logically equivalent?

Are these two queries logically equivalent? DECLARE @DateTime DATETIME = GETDATE() Query 1 SELECT * FROM MyTable WHERE Datediff(DAY, LogInsertTime, @DateTime) > 7 Query 2 SELECT * FROM ...
Alf47's user avatar
  • 971
6 votes
3 answers
45k views

Alternative query to this (avoid DISTINCT)

Note: I work with MSSQL 2008, but I guess it's valid for many others DB engines I have this table "Users": UserID User CountryID 1 user 1 1 2 user 2 2 3 user 3 3 4 user 4 ...
Allende's user avatar
  • 247