Hi All!
I need help with a SQL query.
I got two tables (tblPXtime and tblBudgetTime) with columns and relationships that can be seen in the attachments. From these tables I’d like to extract the date and time, in such manner that all date and time from tblBudgetTime should be collected along with possible matches from tblPXtime. I thought it could be done with OUTER JOINS but I didn’t succeed. Is it even possible to acquire this with a single SQL query?
One of my try goes like;
SELECT tblPXtime.BudgetID, tblBudgetTime.[Year/Month], tblPXtime.TimePX, IIf(IsNull([tblBudgetTime.COs]),[tblBudgetTime.BudgetTime],[tblBudgetTime.BudgetTime]+[tblBudgetTime.COs]) AS TotBudget
FROM tblBudgetTime LEFT OUTER JOIN tblPXtime ON (tblPXtime.BudgetID=tblBudgetTime.BudgetID) AND (tblBudgetTime.[Year/Month]=tblPXtime.[Year/MonthPX])
WHERE tblPXtime.BudgetID=1;
But the result is showed in pic result.gif. Notice that just some of the dates from table tblBudgetTime is listed, but wanted all of the dates…
Cheers!
I need help with a SQL query.
I got two tables (tblPXtime and tblBudgetTime) with columns and relationships that can be seen in the attachments. From these tables I’d like to extract the date and time, in such manner that all date and time from tblBudgetTime should be collected along with possible matches from tblPXtime. I thought it could be done with OUTER JOINS but I didn’t succeed. Is it even possible to acquire this with a single SQL query?
One of my try goes like;
SELECT tblPXtime.BudgetID, tblBudgetTime.[Year/Month], tblPXtime.TimePX, IIf(IsNull([tblBudgetTime.COs]),[tblBudgetTime.BudgetTime],[tblBudgetTime.BudgetTime]+[tblBudgetTime.COs]) AS TotBudget
FROM tblBudgetTime LEFT OUTER JOIN tblPXtime ON (tblPXtime.BudgetID=tblBudgetTime.BudgetID) AND (tblBudgetTime.[Year/Month]=tblPXtime.[Year/MonthPX])
WHERE tblPXtime.BudgetID=1;
But the result is showed in pic result.gif. Notice that just some of the dates from table tblBudgetTime is listed, but wanted all of the dates…
Cheers!