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'
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
From Davor:
Try this:
SELECT * FROM `Quotes` LEFT OUTER JOIN `Products`
ON (`Products`.`QuoteID`=`Quotes`.`QuoteID`)
LEFT OUTER JOIN `Clientes` ON
(`Clientes`.`ClientID`=`Quotes`.`ClientID`)
WHERE `Quotes`.`QuoteID`=6936
Dundo
Still the same... :(
When a QuoteID from Quotes is not available
Olexandr Melnyk wrote:
I din't know about listiтg multiple tables in the JOIN clause up to now,
but anyways it looks like QuoteId from the Products table is overriding
the same field from the Quotes table. Try to replace the asterisk with
an explicit list of fields you want to get.
Hi,
Do you mean that I should replace SELECT * FROM
with SELECT field1, [field2],[...] FROM?
Yes.
If so, I need to specify the table name like SELECT
Clients.Name correct?
You only need to do that when 2 tables have the same column name. In
general, though, it's good practice to always
From Chris,
Do you mean that I should replace SELECT * FROM with SELECT field1,
[field2],[...] FROM?
Yes.
If so, I need to specify the table name like SELECT Clients.Name
correct?
You only need to do that when 2 tables have the same column name. In
general, though, it's good practice to
2007/1/18, Nuno Oliveira [EMAIL PROTECTED]:
Hi, thanks for the reply (you should reply to the list also)
Heh, that was the default Gmail behaviour.
Do you mean that I should replace SELECT * FROM with SELECT field1,
[field2],[...] FROM?
It is generally a good pratice to keep away from