473,394 Members | 1,696 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

STUMPED: How Can I Pull Related Info Using Subqueries/Joins?

I'm creating a tool to browse a database of movie listings. The browser
pulls up 25 results at a time, and you can page through them using 'Next'
and 'Prev' tools. Pretty basic stuff.

Here are my tables:
movies
directors
comments
movies_directors
movies_comments
etc...
(primary key is movies.id)

But here's where I'm stuck: for each film, I need to pull the movie info in
'movies', plus any related data from other tables, like this:

The Lord of the Rings | Peter Jackson | 3 comments
Episode II | George Lucas | 0 comments
Indiana Jones | Steven Spielberg | 15 comments

I seem to run into problems when I try to join info from all of these
related tables. If there's a match, great. But, if not (like a movie with no
comments), the movie is excluded from the result set.

I've tried all sorts of SQL queries to make this work, but nothing seems to
do the trick.

SO, HERE'S MY QUESTION, IS THERE ANY WAY TO DO THIS QUERY WITHOUT
SUBQUERIES/MYSQL 4.0? Or would the best approach be to use PHP to do all the
subquery lookups?

Thanks for your help!
Patrick
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/my***********...ie.nctu.edu.tw

Jul 19 '05 #1
0 1355

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: J Belly | last post by:
Hi, all: This is probably a simple problem, but, as an SQL newbie, I'm having a little trouble understanding multi-joins and subqueries. I have the following tables and columns: ...
5
by: Glenn Mulno | last post by:
Hi, I am trying to create a report page for several teams. Each team runs the same reports but the reports use different values. For a while this was getting insane everytime I updated the...
5
by: Julia Baresch | last post by:
Hi everyone, I haven't found any reference to this problem on this group or in Access 97 help. I hope someone here knows this - probably a simple thing, but not obvious. I designed a query to...
14
by: Darin | last post by:
I have a table that I want to delete specific records from based on data in other tables. I'm more familiar with Access '97, but am now using 2003, but the database is in 2000 format. In '97, I...
0
by: No bother | last post by:
The record source for a form I use is based on a query, which has several layers of subqueries with quite a number of joins. Needless to say this record source is not updateble. However, the data...
0
debasisdas
by: debasisdas | last post by:
Using Subqueries ================== The sub query is often referred to as a nested SELECT, Sub - SELECT, or inner SELECT statement. The sub query executes once before the main query. The...
0
MMcCarthy
by: MMcCarthy | last post by:
Rather than using the Access design view change the view to SQL. I am going to attempt to outline the general syntax used for SQL queries in Access. Angle brackets <> are used in place of some...
5
by: Kardon Coupé | last post by:
Dear All, I'm bemused, I'm moving an application I've written from VB6 into VS2005, and I'm getting all the fundamentals over before I delve into the hard part, like getting the forms layout...
5
by: Element | last post by:
Execution of the following statement sends Access into permanent la-la land, but works fine in SQL Server on the same table: SELECT * FROM tblDailyProofTickets WHERE TicketID NOT IN...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.