List:General Discussion« Previous MessageNext Message »
From:zzapper Date:April 14 2004 8:01pm
Subject:Complicated Inner Joins
View as plain text  
Hi,

I've moved a Database Application from MSAccess to Mysql, most of the
application seems to work fine, but I'm having trouble with Inner
Joins. (The scripting language is ColdFusion MX 6.1) mySql 4.018.

Any help desperately welcome, including explanation of the principles


SELECT i.*, p.ProjectName, si.OrderBy, si.editable,
tbl_SubProject.SubProjectName
  FROM (tbl_Project AS p INNER JOIN 
        (tbl_InvoiceStatus AS si 
          INNER JOIN tbl_Invoice AS i 
          ON si.InvoiceStatus = i.InvoiceStatus)
      ON p.ProjectID = i.ProjectID) 
          LEFT JOIN tbl_SubProject 
          ON i.SubProjectID = tbl_SubProject.SubProjectID
  WHERE i.InvoiceStatus = '#strInvoiceStatus#'
  AND i.ProjectID =#intProjectID#
  AND i.SubProjectID =#intSubProjectID#
  AND i.Deleted = 0
  Order BY si.Orderby,i.InvoiceNumber

General error: You have an error in your SQL syntax near
'(tbl_invoicestatus AS si INNER JOIN tbl_invoice AS i ON si.Invoice'
at line 3 

SELECT i.*, p.ProjectName, si.OrderBy, si.editable,
tbl_subproject.SubProjectName FROM (tbl_project AS p INNER JOIN
(tbl_invoicestatus AS si INNER JOIN tbl_invoice AS i ON
si.InvoiceStatus = i.InvoiceStatus) ON p.ProjectID = i.ProjectID) LEFT
JOIN tbl_subproject ON i.SubProjectID = tbl_subproject.SubProjectID
WHERE i.InvoiceStatus Not IN('Show All') AND i.ProjectID =-1 AND
i.Deleted = 0 Order BY si.Orderby ,i.InvoiceNumber 

zzapper (vim, cygwin, wiki & zsh)
--

vim -c ":%s/^/WhfgTNabgureRIvzSUnpxre/|:%s/[R-T]/ /Ig|:normal ggVGg?"

http://www.vim.org/tips/tip.php?tip_id=305  Best of Vim Tips

Thread
Complicated Inner Joinszzapper14 Apr
  • Re: Complicated Inner JoinsBrent Baisley14 Apr
  • Re: Complicated Inner Joinszzapper15 Apr
  • Re: Complicated Inner Joinszzapper15 Apr
    • Re: Complicated Inner JoinsPaul DuBois17 Apr