how to use inner join in mysql

jion operation in mysql is very useful  we are provide example for this operation

Using inner join only get conman record from table 
 

;

mysql join operation
SELECT username, sex, address, city.cityname, state.statename, country.countryname  FROM user  INNER JOIN  city ON  user.cityid = city.cityid  INNER JOIN state ON city.stateid = state.stateid  INNER JOIN country ON state.countryid = country.countryid  LIMIT 0 , 30 

result :

other example of inner join

table1

id name mobile no
     
   

table2

id address remark
     
   



1.   ” SELECT name , mobileno , table2.address , table2.remark FROM table1  INNER JOIN table2 ON table1.id=table2.id  ”  ;


2.  ” SELECT name , mobileno , table2.address , table2.remark FROM table1  INNER JOIN table2 ON table1.id=table2.id  ORDER BY table1.id  ”  ;




3.  ” SELECT  name , mobileno , table2.address , table2.remark  FROM  table1  INNER JOIN  table2 ON  table1.id=table2.id   WHERE   table1.id=3   ORDER BY  table1.id  ”  ;

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s