在MS Access中:
我正在尝试将两个表与:
- TABLE1.docnumb1 = TABLE2.docnumb2
- looking for: TABLE1.sum <> TABLE2.sum2
但是查询检索到一个错误:from子句中的语法错误(或在创建左联接时出现错误,提示不支持JOIN):
SELECT docnumb1, sum
FROM Table1
JOIN Table2 ON docnumb1 = docnumb2;
如何查询具有不同值的行?
答案 0 :(得分:0)
使用左联接
public static void Main(string[] args)
{
//CreateWebHostBuilder(args).Build().Run();
var host = CreateWebHostBuilder(args).Build();
using (var scope = host.Services.CreateScope())
{
var services = scope.ServiceProvider;
try
{
var context = services.GetRequiredService<AppDbContext>();
//context.Database.EnsureCreated();
DbInitializer.Initialize(context);
}
catch (Exception ex)
{
var logger = services.GetRequiredService<ILogger<Program>>();
logger.LogError(ex, "An error occurred creating the DB.");
}
}
host.Run();
}
答案 1 :(得分:0)
寻找样品(图片) 您可以比较子查询的总和
select t1.rownumb, t1.sum1 -t2.sum2
from (
SELECT rownumb, sum(value) sum1
FROM Table1
group by rownumb
) t1
INNER JOIN
(
SELECT rownumb, sum(value) sum2
FROM Table2
group by rownumb
) t2 ON t1.rownumb = t2.rownumb and (t1.sum1 -t2.sum2 ) <> 0