0

A query or stored procedure to get data from two databases. First get data from school database which is in host1

USE school;
SELECT id FROM student WHERE marks > 80;

With the result of first query from host2, admin database

Use admin;
SELECT * FROM student_details WHERE id IN (result from first db) 

1 Answer 1

0

You're almost there

SELECT 
  * 
FROM
  admin.student_details sd 
WHERE sd.id IN 
  (SELECT 
    s.id 
  FROM
    school.student s 
  WHERE s.marks > 80)

It would be a lot better if you provided some of the sample table, data and your required output

Sign up to request clarification or add additional context in comments.

2 Comments

Sorry its actually database from two different host
See this

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.