Re: SELECT from 3 tables - Need help

2007-01-18 Thread Olexandr Melnyk
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

RE: SELECT from 3 tables - Need help

2007-01-18 Thread Nuno Vaz Oliveira
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 al

RE: SELECT from 3 tables - Need help

2007-01-18 Thread Chris Boget
> 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 in

Re: SELECT from 3 tables - Need help

2007-01-18 Thread Nuno Oliveira
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, th

Re: SELECT from 3 tables - Need help

2007-01-18 Thread Nuno Vaz Oliveira
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

Re: SELECT from 3 tables - Need help

2007-01-18 Thread Davor Dundovic
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 `Quote