From the first table id i want to retrive the stu_name from

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kaif
Forum Newbie
Posts: 12
Joined: Thu Jan 06, 2011 11:12 pm

From the first table id i want to retrive the stu_name from

Post by kaif »

Hi,

From the first table id i want to retrive the stu_name from the second table


For Example:

iam having two tables

in table one (stu_id,division,marks) and in table two (stu_id,stu_name). First I want to merge the two tables and then i want to compare the stu_id through i want to retrieve the stu_name from the table two.

i merge the two tables using "join query" but i can't retrieve the stu_name based on the stu_id in the first table
Peter Kelly
Forum Contributor
Posts: 143
Joined: Fri Jan 14, 2011 5:33 pm
Location: England
Contact:

Re: From the first table id i want to retrive the stu_name f

Post by Peter Kelly »

can we see the query you use and try select it by doing table1.stu_name so put the table name before the field.
s992
Forum Contributor
Posts: 124
Joined: Wed Oct 27, 2010 3:06 pm

Re: From the first table id i want to retrive the stu_name f

Post by s992 »

Give this a shot:

Code: Select all

SELECT table1.stu_id, table2.stu_name FROM table1 INNER JOIN table2 ON table1.stu_id = table2.stu_id
Post Reply