I am putting inner join in my query.I have got the result but didn\'t know that how the data is coming in output.Can anyone tell me that how the Inner join matching the data.Bel
Avoid SELECT *
in your main query.
Avoid duplicate columns: the JOIN
condition ensures One.One_Name
and two.One_Name
will be equal therefore you don't need to return both in the SELECT
clause.
Avoid duplicate column names: rename One.ID
and Two.ID
using 'aliases'.
Add an ORDER BY
clause using the column names ('alises' where applicable) from the SELECT
clause.
Suggested re-write:
SELECT T1.ID AS One_ID, T1.One_Name,
T2.ID AS Two_ID, T2.Two_name
FROM One AS T1
INNER JOIN two AS T2
ON T1.One_Name = T2.One_Name
ORDER
BY One_ID;