简体   繁体   中英

How to write this postgres sql query to oracle?

Following is the postgres SQL query which i have used. I need to change this query to run in Oracle.

SELECT DISTINCT d.id,
                d.title,
                d.entityname,
                d.abstract,
                d.url,
                d.ranking,
                d.forwardemail,
                d.technologyclass,
                d.technology,
                d.product,
                d.technologytype,
                d.comments,
                d.status,
                d.year,
                d.day,
                d.month,
                d.entitytype,
                d.entitysource,
                d.chapter,
                d.country,
                d.region,
                d.address
FROM   research_data d
WHERE  d.status = 'A'
       AND d.id IN(SELECT e.parent_id
                   FROM   research_data_history e
                   WHERE  e.changed_date::DATE = To_date('02-01-13', 'MM-DD-YY')) 

What have you tried? Are you getting an error when running it in Oracle? You should only have to remove ::DATE from the sub select.

SELECT
  e.parent_id
FROM
  research_data_history e
WHERE
  e.changed_date = to_date('02-01-13', 'MM-DD-YY')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM