[Solved] Find the Min and Max date from two tables from a sql select statement


I suspect you are trying to achieve this by using one a single join between the tables – whereas what you actually need is two separate joins:

SELECT table1.module as mod_code, 
       table1.season as psl_code, 
       table2.Sdate as ypd_sdate,
       table3.Edate as ypd_edate
FROM t1 as table1
     JOIN t2 as table2 ON table2.yr = table1.year AND table2.season = table1.season AND table2.weekNo = table1.BeginWeek
     JOIN t2 as table3 ON table3.yr = table1.year AND table3.season = table1.season AND table3.weekNo = table1.EndWeek

1

solved Find the Min and Max date from two tables from a sql select statement