self join in sql with examples | sql server interview question and answer| cricket matches |Part 10
Показать описание
Very common sql server interview question.
Must watch full video guys and do subscribe and please share to others.
Query is available in the comment box.
CREATE TABLE TEAM
(
TEAMID INT,
TEAMNAME VARCHAR(20)
)
INSERT TEAM VALUES (1, 'IND'), (2, 'AUS'), (3, 'SL'), (4, 'PAK')
SELECT * FROM TEAM
SELECT T.TEAMNAME+' VS '+T1.TEAMNAME as MATCHES
FROM TEAM AS T
INNER JOIN
TEAM AS T1
ON T.TEAMID < T1.TEAMID
ssunitech
Hello susheel sir...this is shubham singh...ur videos are informative...
cricketfever
cross apply also work as inner join.
select a.team_id, a.team_name + ' vs '+ c.team_name from cricket a
cross apply (select * from cricket b
where a.team_id < b.team_id) c
narendrakishore
Thanks for explaination. but what is solution if we dont have team id