sql - How to show values from two different queries? -


i have 1 database contains of user information including name. there second database contains notes users , contains #id not name. query doing retrieve user notes doesn't have name doing showing notes, right under doing query retrieve name first database using common #id. won't show.

is there way can query in one? please help. thanks.

use:

   select u.name,           n.*      db2.notes n left join db1.users u on n.id = u.id  order u.name 

assuming connection credentials has access both databases, prefix database name in front of table name , separate period.

the left join show both users, , notes without users associated. here's good primer on joins.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -