//SELECT T1.* FROM (SELECT thinkphp.*, ROW_NUMBER() OVER ( ORDER BY [created_at] desc) AS ROW_NUMBER FROM (SELECT [id],[created_at] FROM [dbo].[wms_load_task] WHERE [id] > '1' GROUP BY [id],[created_at]) AS thinkphp) AS T1 WHERE (T1.ROW_NUMBER BETWEEN 9 + 1 AND 9 + 3)
//UPDATE [dbo].[tt] SET [ii] = '1234' FROM [dbo].[tt] WHERE [id] > 1
//DELETE FROM [dbo].[tt] FROM [dbo].[tt] WHERE [id] > 1
//SELECT T1.* FROM (SELECT thinkphp.*, ROW_NUMBER() OVER ( ORDER BY rand()) AS ROW_NUMBER FROM (SELECT * FROM [dbo].[tt] WHERE [id] > 1) AS thinkphp) AS T1
//SELECT T1.* FROM (SELECT thinkphp.*, ROW_NUMBER() OVER ( ORDER BY rand()) AS ROW_NUMBER FROM (SELECT * FROM [dbo].[tt] WHERE [id] > 1) AS thinkphp) AS T1 WHERE (T1.ROW_NUMBER BETWEEN 1 AND 1)
//INSERT INTO [dbo].[tt] ([id] , [ii]) VALUES (11 , '12345')
//INSERT INTO [dbo].[tt] ([id] , [ii]) VALUES (11 , '12345'),(12 , '12345')
//INSERT INTO [dbo].[tt] ([id] , [ii]) SELECT 17,'12345' UNION ALL SELECT 18,'fsds' UNION ALL SELECT 19,'33fsds'
//SELECT T1.* FROM (SELECT thinkphp.*, ROW_NUMBER() OVER ( ORDER BY [ii] desc) AS ROW_NUMBER FROM (SELECT [id],[ii] FROM [dbo].[tt] INNER JOIN [dbo].[t2] [t2] ON [t2].[iii]=[tt].[id] LEFT JOIN [dbo].[t3] [t3] ON [t2].[iii]=[t3].[ti] WHERE [id] > 1 GROUP BY [id],[ii]) AS thinkphp) AS T1 WHERE (T1.ROW_NUMBER BETWEEN 9 + 1 AND 9 + 3)
// $conn = new \PDO( "sqlsrv:Server=localhost;Database=test", 'test1', '123456');
// $conn->setAttribute( \PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION );
//
// $sql = "SELECT *, 0 AS _NAV_ORDER_F_ FROM [test1].[test] ORDER BY _NAV_ORDER_F_ OFFSET 0 ROWS FETCH NEXT 3 ROWS ONLY"; //默认排序
// $sql = "SELECT * FROM test1.test ORDER BY id DESC OFFSET 0 ROWS FETCH NEXT 3 ROWS ONLY";
// $stmt = $conn->prepare($sql);
// $stmt->execute();
// $re = $stmt->fetchAll(\PDO::FETCH_ASSOC);
// var_dump($re);
//
// $sql = "UPDATE [test1].[test] SET [money] = 33.52 WHERE [id] = 2";
// $sql = "INSERT INTO [test1].[test] ([id], [name], [money], [dates]) VALUES (12, '21', 311.00, '2022-01-09')";
// $sql = "DELETE FROM [test1].[test] WHERE [id] = 12";
// $stmt = $conn->prepare($sql);
// $stmt->execute();
|