Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have accounts and missinginfo table .

I want to show columns from missinginfo table on the basis of id of the account table..

I am using join query for it.. i have a problem with the query can anyone help me .

here is the query
SQL
SELECT missinginfo.Name, missinginfo.fathername, missinginfo.details,account.id
FROM missinginfo
INNER JOIN account
ON missinginfo.id=account.id  where account.username=session['username'];
Posted
Comments
Tom Marvolo Riddle 10-Jan-14 6:10am    
What's the problem?Describe bit more
joginder-banger 10-Jan-14 6:18am    
what's type of error you getting?
Sibasisjena 10-Jan-14 6:20am    
I don't know php but is this "session['username']" allwoed in the mysql script

I guess you just mean you want to show the missing info even if no matching account can be found. You might want to look into OUTER JOIN for that.

Good luck!
 
Share this answer
 
I have corrected it myself.. its like this...

SQL
SELECT missinginfo.Name, missinginfo.fathername, missinginfo.details,account.id
FROM missinginfo
INNER JOIN account
ON missinginfo.id=account.id  where account.username='abc@abc.com';
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900