PHP从多个数据库中提取数据[关闭]

I can't really figure this out.

  1. Database 1
  2. Database 2

    • table in database 1 : people (ID, name, gender, DOB, state)
    • table in database 2 : offenders (ID, etc, etc)

Now I need a query that gives me the (name, gender, DOB, state) if database 2 contains the same ID as database 1.

Should I use a innerjoin for this or what?

Thank you.

You have to use a join and calling database name in it :

SELECT t1.ID, name, gender, DOB, state, t2.stuff, t2.stuff2
FROM database1.people t1
LEFT OUTER JOIN database2.offenders t2 ON t1.id=t2.id