Reputation: 217
How to write a query that returns all the information in the _users tables for all records having login_name or user_name start with letter 'a%' and join these information with tables: _skills (all info) _urls (all info) on github_skills the join is based on user_id the user_id in _skills is the source_id in the _users the id in _urls is the id in _users .
i written like this
SELECT * from stackoverflow_users u, stackoverflow_skills s,github_urls l where s.user_id=u.source_id and l.id=u.id and u.user_name like 'a%';
here i want out put where the empty fileds also.
Please help me.
Upvotes: 0
Views: 73
Reputation: 21667
Your query should give you the rows that have matches in all three tables. If you want all the users even if they don't match in one or both the other tables, use LEFT JOIN:
select *
from stackoverflow_users u
left join stackoverflow_skills s on s.user_id = u.source_id
left join github_urls l on l.id = u.id
where u.user_name like 'a%';
Upvotes: 1