Search
 
SCRIPT & CODE EXAMPLE
 

SQL

SQL select past number of days

select count(Id) as 'Logins for Past 7 Days'
from dbo.Users 
where LastLoggedIn between dateadd(day, -7, convert(date, getdate())) 
and dateadd(day, -0, convert(date, getdate()))
Comment

PREVIOUS NEXT
Code Example
Sql :: set statistics on in ssms 
Sql :: postgres killing connections on db 
Sql :: postgres remove foreign key constraint 
Sql :: sql throw error 
Sql :: STOP message of how many rows affected sql 
Sql :: fill a column in database with a value 
Sql :: check sql database table lock 
Sql :: left join with only first record 
Sql :: oracle sql two left digits 
Sql :: create user mysql 
Sql :: oracle get trigger ddl 
Sql :: load mysql dumb 
Sql :: oracle list index on table 
Sql :: edate dax 
Sql :: Query the list of CITY names from STATION that do not start with vowels and do not end with vowels. Your result cannot contain duplicates. 
Sql :: Are NULL values in a database the same as that of blank space or zero? 
Sql :: psql: error: FATAL: role "postgres" does not exist 
Sql :: update in sql 
Sql :: insert into table from another table mysql 
Sql :: mysqldump password 
Sql :: mysql repair a table 
Sql :: mysql select utc time in eastern time 
Sql :: create row number in sql 
Sql :: go install mysql 
Sql :: mysql trim whitespace 
Sql :: Syntax of for-loop in SQL Server 
Sql :: grant mysql 
Sql :: create function in microsoft sql server 
Sql :: shell mysql connect 
Sql :: not operator in oracle 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =