Hi,
Is it possible to use a select statement inside the where clause?
I have two tables:
users
profiles
Each profile contains a field called userid (which links the profile to the user).
Lets say I want to retrieve the profile of a user using the user's username:
theuserid = SELECT userid FROM users WHERE username=theusername
profile = SELECT [...] FROM profiles WHERE userid=theuseridHow could I combine these two commands into one command (so that I only have to query the database once from my code)?
Is this possible?
SELECT [...] FROM profiles WHERE (SELECT userid FROM users WHERE username=theusername)