Thread: can someone tell me what's wrong with this procedure?
Hi guys,
I have tried to convert an MS Access query into a stored procedure to run on the postgres server. It's saying there is a syntax error, but I'm guessing this is because of the multiple inner joins. Can anyone tell me the correct syntax?
Cheers,
Ben
Attachment
On 8/14/06 8:45 AM, "ben sewell" <mosherben@gmail.com> wrote: > Hi guys, > I have tried to convert an MS Access query into a stored procedure to run on > the postgres server. It's saying there is a syntax error, but I'm guessing > this is because of the multiple inner joins. Can anyone tell me the correct > syntax? From your included procedure: " .... from (tblproviders right join tblnewbusiness on (tblproviders.provider_ref=tblnewbusiness.provider_ref)) and (tblemployee inner join tbladvisersplit on (tblemployee.employee_ref=tbladvisersplit.adviser_ref)) and (tblnewbusiness inner join tblturnover on (tblnewbusiness.newbusiness_ref=tblturnover.newbusiness_ref) )and (tblemployee inner join tbladvisersplit on (tblemployee.employee_ref=tbladvisersplit.adviser_ref)) ...." The "from" clause has "ands" in it, which is not correct for a join. Sean
Hi Sean,
how would I incorporate multiple joins?
Cheers,
Ben
On 8/14/06, Sean Davis <sdavis2@mail.nih.gov> wrote:
On 8/14/06 8:45 AM, "ben sewell" <mosherben@gmail.com > wrote:
> Hi guys,
> I have tried to convert an MS Access query into a stored procedure to run on
> the postgres server. It's saying there is a syntax error, but I'm guessing
> this is because of the multiple inner joins. Can anyone tell me the correct
> syntax?
From your included procedure:
"
.... from
(tblproviders right join tblnewbusiness on
(tblproviders.provider_ref=tblnewbusiness.provider_ref)) and
(tblemployee inner join tbladvisersplit on
(tblemployee.employee_ref=tbladvisersplit.adviser_ref)) and
(tblnewbusiness inner join tblturnover on
(tblnewbusiness.newbusiness_ref=tblturnover.newbusiness_ref) )and
(tblemployee inner join tbladvisersplit on
(tblemployee.employee_ref=tbladvisersplit.adviser_ref)) ...."
The "from" clause has "ands" in it, which is not correct for a join.
Sean
On 8/14/06 10:03 AM, "ben sewell" <mosherben@gmail.com> wrote: > Hi Sean, > how would I incorporate multiple joins? See here, as an example: http://linus.mccabe.nu/?/article/articleview/SQL%20Syntax&Linus=e8376a34908f c288a7f47ec690c61eb1 > On 8/14/06, Sean Davis <sdavis2@mail.nih.gov> wrote: >> >> >> >> >> On 8/14/06 8:45 AM, "ben sewell" <mosherben@gmail.com> wrote: >> >>> Hi guys, >>> I have tried to convert an MS Access query into a stored procedure to >> run on >>> the postgres server. It's saying there is a syntax error, but I'm >> guessing >>> this is because of the multiple inner joins. Can anyone tell me the >> correct >>> syntax? >> >> From your included procedure: >> " >> .... from >> (tblproviders right join tblnewbusiness on >> (tblproviders.provider_ref=tblnewbusiness.provider_ref)) and >> (tblemployee inner join tbladvisersplit on >> (tblemployee.employee_ref=tbladvisersplit.adviser_ref)) and >> (tblnewbusiness inner join tblturnover on >> (tblnewbusiness.newbusiness_ref=tblturnover.newbusiness_ref) )and >> (tblemployee inner join tbladvisersplit on >> (tblemployee.employee_ref=tbladvisersplit.adviser_ref)) ...." >> >> >> The "from" clause has "ands" in it, which is not correct for a join. >> >> Sean >> >>