SQL Query

How To Get The Last Update Of Any Table In MSSQL?

How To Get The Last Update Of Any Table In MSSQL? SELECT OBJECT_NAME ( OBJECT_ID ) AS DatabaseName , last_user_update ,* FROM sys.dm_db_index_usage_stats WHERE database_id = DB_ID ( 'AdventureWorks' ) AND OBJECT_ID = OBJECT_ID ( 'test' )

Get Distinct Maximum Date

Get Distinct Maximum Date Display the latest order of each customers. SELECT A.CustomerID, OrderDate, EmployeeID, ShipperID FROM Orders AS A INNER JOIN (SELECT CustomerID, MAX(OrderDate) AS MaxOrderDate FROM Orders GROUP BY CustomerID) AS B ON A.CustomerID=B.CustomerID AND A.OrderDate=B.MaxOrderDate

Calculate Total Hour and Minute in SQL

SELECT ((DATEDIFF(minute, '2013-06-30 08:30:00.0000000', '2013-06-30 10:45:00.0000000'))/60) AS TotalHour,        ((DATEDIFF(minute, '2013-06-30 08:30:00.0000000', '2013-07-30 10:45:00.0000000'))%60) AS TotalMinute The result of the above query is: TotalHour    TotalMinute       …

Multiple JOIN in MS Access

When you query a multiple join in MSSQL you use this following query: SELECT a.columna, b.columnb, c.columnc FROM tablea AS a LEFT JOIN tableb AS b ON a.id = b.id LEFT JOIN tablec AS c ON a.id = c.id If you use the above query in  MS Access you will encounter an error message "Missing Operator". To reso…

Load More
That is All