Is it possible to use a select statement inside the where clause?
I have two tables:
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:
How could I combine these two commands into one command (so that I only have to query the database once from my code)?
theuserid = SELECT userid FROM users WHERE username=theusername
profile = SELECT [...] FROM profiles WHERE userid=theuserid
Is this possible?
SELECT [...] FROM profiles WHERE (SELECT userid FROM users WHERE username=theusername)