You can't really do that with one query because the database permissions are stored in each database.
You can use sys.server_principals for logins and then loop through the databases to find the what databases a login has permissions in by querying sys.database_principals.