我在Postgresql中有2个表。这两者都是不同的架构。我希望输出在共享屏幕截图中。
假设对于字段HDRConfig,如果输出值是SE,那么我希望输出为软件工程而不是SE。我如何用其余列显示这些,即HDRConfig,AbrConfig& SbrConfig?
答案 0 :(得分:1)
简单//Ajax call for each process and update the UI accordingly
$.get('/services/status/100').then(function(resp) {
$('#service-100').html(resp.responseText);
})
//server side code (express syntax)
app.get('/services/status/:id ', function(req,res) {
// Check if service is ready
serviceManager.isReady(req.params.id, function(err, serviceStats) {
if(err) {
//do logic err here , maybe notify the ui if an error occurred
res.send(err);
return;
}
// notify the ui , that the service is ready to run , and hide loader
res.send(serviceStats);
});
})
:
LEFT JOIN
的 SqlFiddleDemo
强>
SELECT l0.Code_Desc AS HDRConfig,
l1.Code_Desc AS AbrConfig,
l2.Code_Desc AS SbrConfig
FROM Equipment e
LEFT JOIN Lookup l0
ON e.HDRConfig = l0."Code"
LEFT JOIN Lookup l1
ON e.AbrConfig = l1."Code"
LEFT JOIN Lookup l2
ON e.SbrConfig = l2."Code";
使用correletad子查询(效率低下):
╔═══════════════════════╦═══════════════════════╦══════════════════════╗
║ hdrconfig ║ abrconfig ║ sbrconfig ║
╠═══════════════════════╬═══════════════════════╬══════════════════════╣
║ Software Engineering ║ Software Engineering ║ Software Engineering ║
║ (null) ║ Analog System ║ Floppy Primary ║
╚═══════════════════════╩═══════════════════════╩══════════════════════╝
的 SqlFiddleDemo2
强>