Welcome to WebmasterWorld Guest from 54.162.239.134

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

MySQL Multiple Query

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

5+ Year Member



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!

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

WebmasterWorld Administrator lifeinasia is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



SELECT first,last,email from users
UNION
SELECT first,last,email from contacts;
11:20 pm on Oct 14, 2008 (gmt 0)

5+ Year Member



Both tables look very similal why are you storing same data twice?
12:41 am on Oct 15, 2008 (gmt 0)

5+ Year Member



Different data, same fields....contacts contain information not relative to the users table...I will try the union...thanks!
12:44 am on Oct 15, 2008 (gmt 0)

5+ Year Member



UNION was exactly what i was looking for. Thanks!
7:05 am on Oct 30, 2008 (gmt 0)

5+ Year Member



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?

 

Featured Threads

Hot Threads This Week

Hot Threads This Month