Sql stitch subquery?

I have a table that shares no relevance with the main one and yet I would like to somehow search in main query and in that other query for records and somehow combine them one under the other or margin in possible?

Can you be more specific about what you are actually searching for in the tables?

select *, l.address
from google_location g
left JOIN `base_user` `u` ON (g.id=u.id)
where g.address like '%barcelona%'

NOW i have an other table which is new and and contains ferry few rows but I need to pull data from there searching for same address values as in main query.

LEFT JOIN geolocation l ON (l.id = u.id and l.address LIKE '%barcelona%')

It just doesn’t work!

base_user contains all users so this will not work since some records will be in one table but not in other:

LEFT JOIN geolocation l ON (l.id = g.id and l.address LIKE '%barcelona%')

I need to somehow perform another separate search and stitch results under the main ones!

Union won’t work case columns are not same!

if l.id = g.id = u.id, then U and L are related.

I used that and it just doesn’t return anything!

LEFT JOIN geolocation l ON (l.id = u.id and l.address LIKE '%barcelona%')

It’s not relevant to main query!

One moment!

LEFT JOIN geolocation l ON (l.id = u.id and l.address LIKE '%barcelona%') works when user id is in both tables!

How to output results regardless whether there are or not is both tables!

It’s cool I will just run another query thanks.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.