0

Can someone help me with a join query to pull data from 3 different tables which have common columns between each 2 tables. The queries are below:

Query1 = Select * from abc.table1 -- The following are the columns: ID, CODE, DATE, SESSIONTIME.
Query2 = Select * from abc.table3 -- The following are the columns: CODE, Name, BATCH.
Query3 = Select * from abc.table2 -- The following are the columns: BATCH, TITLE

I want a join query to display: CODE, DATE, SESSIONTIME, BATCH, TITLE. DBMS is Microsoft SQL Server

Philatina
  • 1
  • 1

1 Answers1

0
select t1.code, t1.date, t1.sessiontime, t2.batch, t3.title
from abc.table1 t1 (nolock) 
left outer join abc.table2 t2 (nolock) on t1.code=t2.code
left outer join abc.table3 t3 (nolock) on t2.batch=t3.batch
  • Non-standard SQL (nolock), and no dbms specified. At least tell us which dbms this is for. – jarlh Sep 15 '15 at 13:38