我尝试创建postgresql查询,以便从不同的表中获取相同的数据,但是执行时出现错误。在mysql中,我做了类似的查询
> ERROR: syntax error at or near "."
LINE 4: `B`.`_id` AS `_id`
^
> Time: 0.02s
我的查询
SELECT *
FROM
(
SELECT
`B`.`_id` AS `_id`
FROM (
SELECT
`apdi`.`id` AS `_id`
FROM `application_person_document_image` AS `apdi`
INNER JOIN `application_person_document` AS `apd` ON `apdi`.`id` = `apd`.`application_person_document_id`
INNER JOIN `application_person` AS `ap` ON `ap`.`id` = `apd`.`application_person_id`
INNER JOIN `application` AS `a` ON `a`.`id` = `ap`.`application_id`
WHERE
`a`.`id` = 196733
) AS `B`
GROUP BY `B`.`_id`
UNION
SELECT
`N`.`_id` AS `_id`
FROM (
SELECT
`app`.`id` AS `_id`,
FROM `application_person_photo` AS `app`
INNER JOIN `application_person` AS `ap` ON `ap`.`id` = `app`.`application_person_id`
INNER JOIN `application` AS `a` ON `a`.`id` = `ap`.`application_id`
WHERE
`a`.`id` = 196733
) AS `N`
GROUP BY `N`.`_id`
) AS t
怎么了?我查看了文档,使用了别名。