Hi,I was wondering if the following is possible and if not, then how to get around it:I have a main query which return a JOB NUMBER from a table X and I want to apply an outer join from a subquery that returns the total number of hours worked for that job. The problem is that part of the subquery need to use the JOBNO as a filter:select jomast.fjobno...from jomast....left outer join (SELECT substring(ladetail.fjobno,1,5)+'-0000' as job ,Sum(datediff(minute,fsdatetime,fedatetime)) AS minutesFROM ladetail WHERE (ladetail.FCDEPT<>'50') AND (ladetail.fjobno>'10000') and ladetail.fjobno LIKE SUBSTRING(jomast.fjobno,1,5)+'%' group by substring(ladetail.fjobno,1,5)) AS F on jomast.fjobno = F.job )
so essentially it is like passing a parameter to the subquery.... How can I do this legally?the message I get now is:The column prefix 'jomast' does not match with a table name or alias name used in the query.