Multiple SELECT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I know this issue comes up alot, I've looked through the archives
looking for a solution, but none of them are what I want. I have two
tables with share a common coloumn, username. One is the user table.
It's used to store the user's password, username, email and so on. The
other table is for the user's profile (if they choose to have one). It
contains msnm, aim, yahoo etc address, birthdate and other stuff like
that. So far I have this query:
"SELECT
	forumusers.email AS email,forumusers.username AS username,forumusers.level AS level,
	forumusers.lastlogon1 AS lastlogon1,forumusers.lastlogon2 AS lastlogon2,forumusers.settings1 AS settings1,forumusers.confirmationcode AS confirmationcode, 
	forumuserprofiles.sex AS sex, forumuserprofiles.birthdate AS birthdate,
	forumuserprofiles.address_msnm AS address_msnm, forumuserprofiles.address_aim AS address_aim, 
	forumuserprofiles.address_yahoo AS address_yahoo, forumuserprofiles.address_icq AS address_icq  
	FROM ".$godlyness['database_database'].".forumusers,".$godlyness['database_database'].".forumuserprofiles ".$filterbu."
	ORDER BY username 
	"

It works, but not the way I want it to. See, it's not a guaruntee that
every user will have a profile. So far, if the user doesn't have a
profile, it will display the information of someone else. Is there a way
to make the returned columns NULL if the row doesn't exist for the user?

Oh yeah, I tried doing a
WHERE forumusers.username=forumuserprofiles.username
It worked, but if I added a AND forumusers.username = 'search string
here' it didn't return anything.
Any ideas?
-- 
  Marcjon

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux