468,544 Members | 1,735 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,544 developers. It's quick & easy.

Multiple Tables Help Needed

I'm not sure the follow multiple table query is the right way to do
what I need to do although it seems to be working:

$php_SQL = "SELECT * ".
"FROM basics, personal, photos ".
"WHERE basics.member_name = personal.member_name ".
"AND basics.member_name = photos.member_name ".
"AND basics.account_creation_date >= DATE_SUB(NOW(),

I primarily need to return a resultset for all member_names (they are
index key) filtered for the last 30 days on the
basics.account_creation_date - the 30 day thing is working fine.

I need to access various other table columns (fields) and display this
data on the web page - member_name is the common key for all tables -
this all seems to be working fine as I have 8 test records and can
manually track and see that it is working - the problem is that I need
to add a 4th table and in doing so, the resultset breaks and returns
just one record - I am adding an 'online' table with a col called
is_online which is set to 'yes' if the member is online but the
following query returns just the one record of the online member:

$php_SQL = "SELECT * ".
"FROM basics, personal, photos, online ".
"WHERE basics.member_name = personal.member_name ".
"AND basics.member_name = photos.member_name ".
"AND basics.member_name = online.member_name ".
"AND basics.account_creation_date >= DATE_SUB(NOW(),

It seems to me this should be an easy thing to just add the 4th table
but since this breaks the query now I'm wondering if this query
structure is even built right?

Any help would be greatly appreciated...

Jul 19 '05 #1
0 1261

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by RJ | last post: by
6 posts views Thread by Christopher Harrison | last post: by
5 posts views Thread by Scott Tilton | last post: by
11 posts views Thread by dskillingstad | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by UniDue | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.