troubleshooting Question

Query Help - joining tables/union

Avatar of dsrnu
dsrnu asked on
PHPMySQL Server
4 Comments2 Solutions228 ViewsLast Modified:
Hi everyone,

I was wondering if there was a way to join two tables together where:

- pull all information from table 1
- pull added information from table 2, if it exists (combine like table1.id = table2.id)

I tried using join (left, right, inner, outer, etc.) but no luck.
Table: seller

----------------
- id - user_id -
----------------
- 1  -   50    -
- 2  -   53    -
- 3  -   67    -
----------------

Table: user

-------------------------------------
- id - username - email             -
-------------------------------------
- 1  - jdoe     - jdoe@gmail.com    -

....

- 50 - suprman  - suprman@gmail.com -
- 51 - wndrwmn  - wndrwm@gmail.com  -
-------------------------------------

Desired Output:

Pull all data from "user" table and include "seller" data, if user.id = user_id exists.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros