MSSQL-SQL SERVER一些使用中的技巧

获取前一天时间"getdate() - 1"

获取上一小时时间"dateadd(hour, -1, getdate())"

order by field1, field2 可以更细致排序进行输出

分页语句

SELECT TOP $row * FROM (SELECT ROW_NUMBER() OVER (ORDER BY [Date] desc) AS RowNumber, * FROM [MyDb].[dbo].[Platform_Statistic]) A WHERE RowNumber > + ($page - 1) * $row ORDER BY RowNumber

你可能感兴趣的:(SQL Server)