If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > joining agents and customers to invoices (was "please help !!!!!!!!!!")

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-15-05, 06:26
asif_8 asif_8 is offline
Registered User
 
Join Date: Jan 2005
Posts: 5
Red face 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'
Reply With Quote
  #2 (permalink)  
Old 02-15-05, 09:30
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
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
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On