Assistance Required - Syntax.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kevin Michael Reed

    Assistance Required - Syntax.

    ------=_NextPart_000_ 002B_01C34DF8.C 34C94F0
    Content-Type: text/plain;
    charset="iso-8859-1"
    Content-Transfer-Encoding: quoted-printable

    Assistance required.

    I have 3 tables:



    TABLE: client_invoice
    - client_id *1(show all from client_invoice, only those w/ info from =
    client_info)
    - invoice_amount
    - invoice_date_du e

    TABLE: client_info
    - client_id *1(show all from client_invoice, only those =
    w/ info from client_info)
    - client_city
    - client_state *2(show all from client_info, only those w/ =
    match from client_info)
    - client_country *3(show all from client_info, only those w/ =
    match from client_info)
    - apply_tax

    TABLE: tax_zones
    - tid
    - countries_iso_2 *3 (show all from client_info, only those w/ match =
    from client_info)
    - tax_zone *2(show all from client_info, only those w/ =
    match from client_info)
    - tax_amount
    - tax_desc
    - tax_status


    (if I was drawing this on paper, or creating it in access, I would join =
    based on the *'s above)


    Here's the select query, I'm attempting to use....

    SELECT client_invoice. client_id, client_invoice. invoice_amount, =
    client_invoice. invoice_date_du e, client_info.cli ent_city, =
    client_info.cli ent_state, client_info.cli ent_country, =
    client_info.app ly_tax, tax_zones.count ries_iso_2, tax_zones.tax_z one, =
    tax_zones.tax_a mount, tax_zones.tax_d esc, tax_zones.tax_s tatus, =
    (1-(tax_zones.tax_ amount/100)) AS BillRate, =
    if(client_info. apply_tax=3D0,( client_invoice. invoice_amount-(client_invoi=
    ce.invoice_amou nt*BillRate)),0 ) AS Amt_taxed FROM tax_zones RIGHT JOIN =
    (client_info RIGHT JOIN client_invoice ON =
    client_info.cli ent_id=3Dclient _invoice.client _id) ON =
    (tax_zones.tax_ zone=3Dclient_i nfo.client_stat e) AND =
    (tax_zones.coun tries_iso_2=3Dc lient_info.clie nt_country)


    I'm getting the following error: You have an error in your SQL syntax =
    near '(client_info RIGHT JOIN client_invoice ON =
    client_info.cli ent_id=3Dclient _invoice.c'=20


    any ideas as to how to fix the syntax of this query? I'm sure it's =
    something simple, but I'm still a newbie to MySQL.





    Kevin Michael Reed
    kreed@tnolnet.c om
    President
    TNOLnet.com

    ------=_NextPart_000_ 002B_01C34DF8.C 34C94F0--

Working...