Access 2003 SQL Syntax error in join message -
i new @ coding in sql access 2003 , having problem showing additional column called action shown on tledgers table. recieving syntax error message not sure why?
below code snippet causing issue
from (tdailyentries inner join tdailyentries on tledgers.action = tdailyentries.actionno)
below full code
select distinct tprojects.cc_io projectno, year([datefrom]) & " accrual " & monthname(month([datefrom])) & " - "+[companyname] & " ( "+([lastname]) & ")" [line/item/text], tusers.lastname last_name, tdailyentries.userid userid, contractordailyrate dailyrate, contractordailyhours hours, round(contractordailyrate / contractordailyhours, 2) hourlyrate, round(sum(tdailyentries.calculateddailyhours), 2) monthlyhours, round((hourlyrate * monthlyhours), 2) charge, round(charge+round((charge*0.2),2),2) accruals, tprojects.project project (tdailyentries inner join tdailyentries on tledgers.action = tdailyentries.actionno) (tprojecttype right join tprojects on tprojecttype.projecttypeid = tprojects.projecttypeid) right join (textcontractor right join (ttitle right join (((tlocation right join (tdepartments right join tusers on tdepartments.deptid = tusers.deptid) on tlocation.locationid = tusers.locationid) right join (((tdailyentries left join tdepartments tdepartments_1 on tdailyentries.deptcharged = tdepartments_1.deptshortname) left join tactions on tdailyentries.actionno = tactions.actionid) left join tlookups on tdailyentries.zone = tlookups.lookupid) on tusers.userid = tdailyentries.userid) left join textmain on tusers.userid = textmain.userid) on ttitle.titleid = tusers.titleid) on textcontractor.companyid = textmain.contractorcompany) on tprojects.projectid = tdailyentries.projectno ttitle.titleid = 37 , month([datefrom]) = monthnum , day([datefrom]) <21 group tprojects.cc_io, year([datefrom]) & " accrual " & monthname(month([datefrom])) & " - "+[companyname] & " ( "+([lastname]) & ")", tusers.lastname, tdailyentries.userid, textmain.contractordailyrate, month([datefrom]), textmain.contractordailyhours, tprojects.project;
please see updated code below
select distinct tprojects.cc_io projectno, year([datefrom]) & " accrual " & monthname(month([datefrom])) & " - "+[companyname] & " ( "+([lastname]) & ")" [line/item/text], tusers.lastname last_name, tdailyentries.userid userid, contractordailyrate dailyrate, contractordailyhours hours, round(contractordailyrate / contractordailyhours, 2) hourlyrate, round(sum(tdailyentries.calculateddailyhours), 2) monthlyhours, round((hourlyrate * monthlyhours), 2) charge, round(charge+round((charge*0.2),2),2) accruals, tprojects.project project (tdailyentries inner join tledgers on tledgers.action = tdailyentries.actionno) (tprojecttype right join tprojects on tprojecttype.projecttypeid = tprojects.projecttypeid) right join (textcontractor right join (ttitle right join (((tlocation right join (tdepartments right join tusers on tdepartments.deptid = tusers.deptid) on tlocation.locationid = tusers.locationid) right join (((tdailyentries left join tdepartments tdepartments_1 on tdailyentries.deptcharged = tdepartments_1.deptshortname) left join tactions on tdailyentries.actionno = tactions.actionid) left join tlookups on tdailyentries.zone = tlookups.lookupid) on tusers.userid = tdailyentries.userid) left join textmain on tusers.userid = textmain.userid) on ttitle.titleid = tusers.titleid) on textcontractor.companyid = textmain.contractorcompany) on tprojects.projectid = tdailyentries.projectno ttitle.titleid = 37 , month([datefrom]) = monthnum , day([datefrom]) <21 group tprojects.cc_io, year([datefrom]) & " accrual " & monthname(month([datefrom])) & " - "+[companyname] & " ( "+([lastname]) & ")", tusers.lastname, tdailyentries.userid, textmain.contractordailyrate, month([datefrom]), textmain.contractordailyhours, tprojects.project;
updated code 2
select distinct tprojects.cc_io projectno, year([datefrom]) & " accrual " & monthname(month([datefrom])) & " - "+[companyname] & " ( "+([lastname]) & ")" [line/item/text], tusers.lastname last_name, tdailyentries.userid userid, contractordailyrate dailyrate, contractordailyhours hours, round(contractordailyrate / contractordailyhours, 2) hourlyrate, round(sum(tdailyentries.calculateddailyhours), 2) monthlyhours, round((hourlyrate * monthlyhours), 2) charge, round(charge+round((charge*0.2),2),2) accruals, tprojects.project project (tdailyentries inner join tledgers on tledgers.action = tdailyentries.actionno) inner join (tprojects on tprojecttype.projecttypeid = tprojects.projecttypeid right join (textcontractor right join (ttitle right join (((tlocation right join (tdepartments right join tusers on tdepartments.deptid = tusers.deptid) on tlocation.locationid = tusers.locationid) right join (((tdailyentries left join tdepartments tdepartments_1 on tdailyentries.deptcharged = tdepartments_1.deptshortname) left join tactions on tdailyentries.actionno = tactions.actionid) left join tlookups on tdailyentries.zone = tlookups.lookupid) on tusers.userid = tdailyentries.userid) left join textmain on tusers.userid = textmain.userid) on ttitle.titleid = tusers.titleid) on textcontractor.companyid = textmain.contractorcompany) on tprojects.projectid = tdailyentries.projectno ttitle.titleid = 37 , month([datefrom]) = monthnum , day([datefrom]) <21 group tprojects.cc_io, year([datefrom]) & " accrual " & monthname(month([datefrom])) & " - "+[companyname] & " ( "+([lastname]) & ")", tusers.lastname, tdailyentries.userid, textmain.contractordailyrate, month([datefrom]), textmain.contractordailyhours, tprojects.project;
that join
operation wrong cause depicts doing self join
on tdailyentries
join on
condition contradicts since trying match tledgers.action
. believe meant do
..... tdailyentries inner join tledgers on tledgers.action = tdailyentries.actionno
per comment:
you have 2 from
clause in query below
from (tdailyentries inner join tdailyentries on tledgers.action = tdailyentries.actionno) (tprojecttype
change to
from tdailyentries inner join tledgers on tledgers.action = tdailyentries.actionno inner join tprojecttype on ...
Comments
Post a Comment