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
Related Q & A:
- Is Guillou-Quisquater existentially unforgeable against adaptive message attack under a random oracle model?Best solution by Cryptography
- Is it possible to migrate Oracle SOA BPEL instances from one environment to another with history?Best solution by Server Fault
- How can I optimize this dynamic SQL query in oracle with PL/SQL?Best solution by docs.oracle.com
- How to know the Oracle Database Name?Best solution by Stack Overflow
- How to convert VARCHAR to TIMESTAMP in MySQL?Best solution by Stack Overflow
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
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.