Hi All,

I'm working on a Intranet database with a few tables to allow all
the workers from the company to access it.

However, I'm facing a problem with a QUERY. I've did try to use
JOIN but I'm not able to get the results I need...

I have 3 tables (concerning this problem):

Table 'Quotes'
  QuoteID
  ClientID
  Date
  Price
  Comments

Table 'Clients'
  ClientID
  Name
  Address
  Email

Table 'Products'
  QuoteID
  ProductName
  ProductType
  ProductShape

After filling the info to table quotes, I would like to do a QUERY
to SELECT a specific QuoteID and also to JOIN to the result the
client information (being ClientID the relation) and also to JOIN
the information of the product if available (being QuoteID the
relation).

The problem is that if there is no data in table 'Products' that
matched QuoteID from table 'Quotes' than, the field 'QuoteID' is
returned empty.

I would like to do a SELECT that would return all the fields in the
'Quotes' table plus the client info and plus the product info but
only if available. If product info is not available I would like to
get a result having all 'Quotes' info and 'Clients' info.

My query is:

SELECT * FROM `Quotes` LEFT JOIN (`Products`,`Clientes`)
  ON (`Products`.`QuoteID`=`Quotes`.`QuoteID`
  AND `Clientes`.`ClientID`=`Quotes`.`ClientID`)
  WHERE `Quotes`.`QuoteID`=6936

Any suggestion?

Thanks

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to