homepage Welcome to WebmasterWorld Guest from 54.242.18.190
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
MySQL Multiple Query
paseo




msg:3765727
 10:28 pm on Oct 14, 2008 (gmt 0)

Hi,

I am trying to select data from two separate tables and display everything, not filter based upon information within both tables.

Example, i would like to join these to statements together:

SELECT first,last,email from users;

SELECT first,last,email from contacts;

Any ideas or direction? I have looked into JOINS but doesnt seem to be offering what i'm looking for.

Thanks!

 

LifeinAsia




msg:3765731
 10:47 pm on Oct 14, 2008 (gmt 0)

SELECT first,last,email from users
UNION
SELECT first,last,email from contacts;

Mohamed




msg:3765753
 11:20 pm on Oct 14, 2008 (gmt 0)

Both tables look very similal why are you storing same data twice?

paseo




msg:3765783
 12:41 am on Oct 15, 2008 (gmt 0)

Different data, same fields....contacts contain information not relative to the users table...I will try the union...thanks!

paseo




msg:3765794
 12:44 am on Oct 15, 2008 (gmt 0)

UNION was exactly what i was looking for. Thanks!

aftershock2020




msg:3776474
 7:05 am on Oct 30, 2008 (gmt 0)

Which would be best for passing one login username/password to a main script and subscripts, for bypassing the need of the user to sign unto each and every sub script seperately...

Example would be for the main login to pass the active session to all of the multiple scripts in the entire site for automatic accessability without having to login for each new script.

Join, Union or a different process all together?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved