- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已经尝试了几个小时来完成这项工作,但我真的找不到办法。我有一个 MySQL 脚本,需要迁移到 MS SQL 2014,但是,我似乎无法使其工作。据我了解,最大的问题是 MySQL 允许这种指令:
SELECT @row_number = @row_number + 1, hora_int FROM table1;
您可以在检索数据的同时赋值,但 MS SQL 不会。
我有一个相对较大的脚本存在这个问题:
SELECT GLOBAL.year, GLOBAL.month, '1111111' as metric_id, GLOBAL.margin as metric_value FROM (SELECT A.year,
A.month,
CASE
WHEN A.month = 1 THEN (@csum_fdo := A.imp)
ELSE (@csum_fdo := @csum_fdo + A.imp) END as margin
FROM (SELECT Act.year, Act.month, Act.imp - Pas.imp as imp
FROM (SELECT year(tie.date) as year, month(tie.date) as month, sum(importe) as imp
FROM accounting con,
dim_time tie,
dim_account cta
WHERE con.account_date = tie.date
AND con.account = cta.nivel_10
AND cta.level_id = '2'
AND con.subtype_id <> 'O'
GROUP BY year(tie.date),
month(tie.date)) Act,
(SELECT year(tie.date) as year, month(tie.date) as month, sum(importe) * -1 as imp
FROM accounting con,
dim_time tie,
dim_account cta
WHERE con.account_date = tie.date
AND con.account = cta.nivel_10
AND cta.level_id = '3'
AND con.subtype_id <> 'O'
GROUP BY year(tie.date),
month(tie.date)) Pas
WHERE Act.year = Pas.year
AND Act.month = Pas.month) A,
(SELECT @csum_fdo := 0) E) GLOBAL
任何人都可以指出我必须做什么才能在 MS SQL 中重新创建代码吗?先谢谢大家了
最佳答案
在 SQL Server 和 (MyQL 8+) 中,您使用窗口函数。相当于:
SELECT @row_number = @row_number + 1, hora_int
FROM table1
ORDER BY col;
是:
SELECT ROW_NUMBER() OVER (ORDER BY col), hora_int
FROM table1;
如果您提供示例数据和期望的结果,就更容易找出您真正需要的功能。
关于mysql - 将 MySQL 脚本移植到 MS SQL -> 同时进行数据分配和检索,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53833131/
我是 Mercurial 的新手,并且不知何故仍处于评估过程中,所以这四个概念对我来说有点困惑。有些被提到等同于 Git 的 Staging/Index 概念,有些甚至比 Git 的 Staging
如何将在某些网站 (www.example1.com) 上用某种语言即 (java) 制作的 session 传送到用其他语言制作的网站,即在某些其他网站上的 (php),即 (www.example
我有以下代码行我想移植到 Torch Matmul rotMat = xmat @ ymat @ zmat 我能知道这是不是正确的顺序: rotMat = torch.matmul(xmat, tor
我正在尝试移植一个内部有一个联合的 C 结构。 Winapi.Winsock2.pas 中的默认结构记录中缺少某些字段。 但这是正确的方法吗?谢谢。 typedef struct _WSACOMPLE
我想将基于 webkit 的浏览器移植到我的堆栈中。谁能介绍一下 webkit 浏览器引擎的组织结构?目前我所知道的是它具有用于呈现 html 和解析 javascript 的核心。我想了解更多,比如
我目前有一个 ActiveX 控件,它链接到许多 c/c++ dll。问题是我们现在需要此控件在 IE 以外的浏览器(最重要的是 Firefox)上运行。 在我看来,我有以下选择: 将控件编写为 fi
我正在尝试在 Objective-C 中重写 Java 库。我想将其重写为 API,以便需要实现某些方法。我已经开始尝试重写代码,但遇到了一些问题。 Objective-C 是否支持抽象类? 如果没有
我已经有一段时间没有接触 SQL 了,所以我需要重新学习一下。我的计算机上运行着一个 SQL 数据库,我的服务器是 localhost。我在 VB.Net 中制作了一个连接到该数据库的应用程序。一切都
按照目前的情况,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit th
运行命令时出现错误 [root@himanshi busybox-1.20.2]# make ARCH=arm CROSS_COMPILE=arm-unknown-linux-gnueabi- CON
我需要将为 iPhone 编写的现有游戏移植到 Flash。 iPhone 游戏主要是用纯 C 而不是 Objective C 编写的。 我想知道是否有任何好的工具可以将 C 代码直接转换为 Acti
我将要在 Smalltalk (Pharo) 中构建一个项目。还有一个 python 库,我打算将其用于相同的目的。现在,有 3 个选项: 那些 python 库的 Smalltalk 包装器 将 p
我必须在 GPU 上移植一个广泛使用随机数的结构。一切都可以毫无问题地移植,但随机生成器函数是唯一在该类的所有函数中被广泛调用的函数。我虽然可以简单地将它重新实现为类本身的内部设备函数。下面我放了一个
我对整个移植问题有点陌生,因为 Android SDK 提供的模拟器速度很慢,所以我解决了这个问题。 我下载了 android-x86-3.2-RC2-eeepc 和 android-x86-3.2-
我们的数据库 (PostgreSQL 9.x) 中有一些 PL/pgSQL 存储过程。 这些是严格顺序的,在某些情况下,可能会非常慢。 我们正在考虑将它们移植到 PL/Java、PL/Python 或
我有一个 Android 应用程序可以处理圆顶图像。出于性能原因,我想用 C++ 编写应用程序的某些部分,然后通过 NDK 调用这些方法。我是否需要一个特定的 C++ 编译器(例如用于嵌入式系统)或者
我正在从事一个将一大堆 OS-9(微软件)代码移植到 linux 的项目。 OS-9 中的信号处理功能允许您创建自己的信号,或者至少它是如何实现的(intercept() 函数)。我对 linux 信
目前我有这个 gtk2 代码: GList *input_devices = gdk_devices_list(); while(input_devices) { GdkDevice *devic
我正在尝试移植 Aether.Physics2D从 C# 到 Xojo 的库。这本质上是 Farseer 物理引擎的调整版本。大部分已经完成,但有一部分源代码我无法解决(可能是因为 C# 不是我的主要
我们正在开发采用 RISCV 架构的多核处理器。 我们已经为单核 RISCV 处理器移植了 Linux,它正在我们自己的基于 FPGA 的主板上使用 busybox rootfs。 我现在想为多核 R
我是一名优秀的程序员,十分优秀!