How to convert Oracle script to MySQL script?

Convert oracle script to mysql script

  • Need help on this I am migrating the database from oracle to mysql. I am running the below query in oracle it works fine but in mysql getting INSERT INTO xyz(rid, pid) SELECT rid, pid FROM ( (SELECT distinct rd,(SELECT p.pid FROM abc p WHERE p.permission='jury') AS pid FROM xyz WHERE pid IN (SELECT p.pid FROM abc p WHERE p.permission in ('jury')))); Getting the below error Every derived table must have its own alias [SQL State=42000, DB Errorcode=1248]

  • Answer:

    I'm not a MySQL user, but googling the error shows that it's expecting the inline view to have an alias: insert into xyz (rid, pid) select rid, pid from ( (select distinct rd, (select p.pid from abc p where p.permission = 'jury') as pid from xyz where pid in (select p.pid from abc p where p.permission in ('jury')))) res; However, isn't this just a really, really overly complicated way of doing: insert into xyz (rid, pid) select distinct xyz.rd, abc.pid from xyz inner join abc on (xyz.pid = abc.pid and abc.permission = 'jury'); ?

giri at Stack Overflow Visit the source

Was this solution helpful to you?

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.