Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2005
    Posts
    5

    Red face Unanswered: joining agents and customers to invoices (was "please help !!!!!!!!!!")

    i have got 2 tables one is invoice and the other is product and the thing is for one incoice there can be many products.....

    i'm making my database front end in vb6 and i'm making this invoice form where i'm displaying customer names and deliveryref names but in the invoice table i'm storing only there key fields for example custid, deliveryid and so forth.
    but now the scenario is that i want all the information from all the tables using there id's what can i do...can somebody please help me .....this is what i have been trying to do

    select invoice.*,products.*,agents.companyname,customer.f irstname,customer.lastname
    from invoice
    left join agents on (products.agentid=agents.agentid)
    left join customer on (products.custid=customer.custid)
    where invoice.invoiceno='8'

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    you use products.something in the SELECT list and both ON clauses, but you don't actually include the products table anywhere in the FROM clause
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •