我正在使用 BIDS 通过 ODBC 连接连接到 Progress DB:此查询工作正常
SELECT
PUB."master"."app-number",
...
PUB."property"."prop-id",
FROM
PUB."master" master JOIN PUB."property" property ON
master."lt-acnt" = property."lt-acnt"
...
LEFT OUTER JOIN PUB."arm" arm ON
master."lt-acnt" = arm."lt-acnt"
WHERE
...
但是,我需要从另一个表中添加一些额外的字段。问题是我只需要上次更新这些新字段时的信息。
我努力了:
SELECT
yt."app-number"
...
yt."disc-adj-tot",
yt."rt-adj-nbr",
yt."base-disc-per"
FROM (
SELECT PUB."master"."app-number",
...
PUB."lt-rt-adj-hdr"."disc-adj-tot",
PUB."lt-rt-adj-hdr"."rt-adj-nbr",
PUB."lt-rt-adj-hdr"."base-disc-per"
FROM PUB."master" master JOIN PUB."property" property ON
master."lt-acnt" = property."lt-acnt"
...
JOIN PUB."lt-rt-adj-hdr" lt_rt_adj_hdr ON
lt_master."lt-acnt" = lt_rt_adj_hdr."lt-acnt") yt
INNER JOIN(
SELECT "app-number",
MAX("rt-adj-nbr") "rt-adj-nbr"
FROM ( PUB."lt-master" lt_master JOIN
PUB."lt-rt-adj-hdr" lt_rt_adj_hdr ON
lt_master."lt-acnt" = lt_rt_adj_hdr."lt-acnt")
GROUP BY "app-number") ss on yt."app-number" = ss."app-number" and
yt."rt-adj-nbr" = ss."rt-adj-nbr"
WHERE ...
除非使用非常简单的 WHERE 子句,例如“WHERE yt.”app-number” = 123456”,否则此查询将挂起并且不会返回结果。我完全被困住了。