1

SELECT t13_Literature_Material_Codes.Databank, t13_Literature_Material_Codes.BASE_NUMB, t13_Literature_Material_Codes.BASE_SYMB, t13_Literature_Material_Codes.BASE_CHAR, t13_Literature_Material_Codes.BASE_MOLW, CorrosionRatesInfo.RatesValidFlag FROM CorrosionRatesInfo RIGHT JOIN t13_Literature_Material_Codes ON CorrosionRatesInfo.BASE_NUMB=t13_Literature_Material_Codes.BASE_NUMB;

如何在 sqlite 中进行此查询?我看到人们使用左外连接。请提供使用类似结构的解决方案,然后我的 c++ 程序可以使用简单的解析器过程修改查询字符串。

4

2 回答 2

0

要在 Sqlite 中执行此查询:

SELECT t13_Literature_Material_Codes.Databank, t13_Literature_Material_Codes.BASE_NUMB, 
t13_Literature_Material_Codes.BASE_SYMB, t13_Literature_Material_Codes.BASE_CHAR, 
t13_Literature_Material_Codes.BASE_MOLW, CorrosionRatesInfo.RatesValidFlag FROM 
CorrosionRatesInfo RIGHT OUTER JOIN t13_Literature_Material_Codes ON  
CorrosionRatesInfo.BASE_NUMB=t13_Literature_Material_Codes.BASE_NUMB;

只需要添加 "RIGHT OUTER JOIN" 。

于 2012-08-29T19:34:31.860 回答
0

用户 UNION 来解决这个问题

例如

SELECT employee.*, department.*
FROM   employee 
       LEFT JOIN department 
          ON employee.DepartmentID = department.DepartmentID
UNION ALL
SELECT employee.*, department.*
FROM   department
       LEFT JOIN employee
          ON employee.DepartmentID = department.DepartmentID
WHERE  employee.DepartmentID IS NULL

是的,请参阅 Wikipedia 上的示例。

于 2016-06-08T05:48:19.237 回答