[SOLVED] Which join should I be using

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
impulse()
Forum Regular
Posts: 748
Joined: Wed Aug 09, 2006 8:36 am
Location: Staffordshire, UK
Contact:

[SOLVED] Which join should I be using

Post by impulse() »

I have 2 tables and I want all the data from table 1 to be displayed and I want 1 field from table 2 to be joined onto the side, whether the field is blank or contains data. But at the moment it's either outputting 38,000+ rows when there should only be 3000 rows.
Last edited by impulse() on Sun Aug 26, 2007 8:30 am, edited 1 time in total.
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post by Oren »

Sounds like a LEFT JOIN to me, but we can't help you... You need to give us more information.
impulse()
Forum Regular
Posts: 748
Joined: Wed Aug 09, 2006 8:36 am
Location: Staffordshire, UK
Contact:

Post by impulse() »

It was my fault, I was being totally stupid and joining on the wrong fields. It was a left join though.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Post by califdon »

impulse() wrote:It was my fault, I was being totally stupid and joining on the wrong fields. It was a left join though.
We've all done that, but please do us a favor: please go back and edit the Subject of your post to indicate [RESOLVED] so that hundreds more of us don't spend the time reading the thread, only to realize that there is no longer a problem. Thank you.
Post Reply