MariaDB Select从内部选择

时间:2017-02-10 15:07:04

标签: sql select where mariadb

我有一个选择,其中有两个内部选择以前我只需要外部选择的值,但现在我需要从内部选择获得值:

SELECT
  a.Id,
  a.Position,
  b.CompanyId
FROM Positions a
WHERE Employee IN (
  SELECT IdEMEmployee
  FROM Employees b
  WHERE CompanyId IN (
    SELECT CompanyId
    FROM Parameters c
    WHERE CompanyParameter = 'Test Company')) AND
      (ValidUntil > '2018-01-01' OR ValidUntil IS NULL) AND
      (ValidFrom < '2017-01-01' OR ValidFrom IS NULL)
ORDER BY a.Position, a.Id DESC;

b.CompanyId无法访问的问题是否可以在没有连接的情况下进行?

0 个答案:

没有答案