Re: JOIN - Which and how?

2008-12-03 Thread Ananda Kumar
The reason ur getting empty result set is becuase both tables have raw_mat_id (1,2). Insert a new record into raw_materials and not into raw_materials_product, then you would get the missing record. On 12/3/08, Nigel Peck <[EMAIL PROTECTED]> wrote: > > Nigel Peck wrote: > >> Ananda Kumar wrote: >

Re: JOIN - Which and how?

2008-12-03 Thread Nigel Peck
Nigel Peck wrote: Sorry, make that: SELECT `Raw_materials`.`raw_mat_id`, `Raw_materials`.`name` FROM `Raw_materials` LEFT JOIN `Raw_materials__Products` ON `Raw_materials`.`raw_mat_id` = `Raw_materials__Products`.`raw_mat_id` WHERE

Re: JOIN - Which and how?

2008-12-03 Thread Nigel Peck
Nigel Peck wrote: Ananda Kumar wrote: did u try this select * from raw_materials where raw_mat_id not in (select raw_mat_id from raw_materials__Products); Hi Ananda, Thanks for this, I'm really looking to do this in a single SELECT, for efficiency. I'm sure it's possible with a join but j

Re: JOIN - Which and how?

2008-12-03 Thread Nigel Peck
Ananda Kumar wrote: did u try this select * from raw_materials where raw_mat_id not in (select raw_mat_id from raw_materials__Products); Hi Ananda, Thanks for this, I'm really looking to do this in a single SELECT, for efficiency. I'm sure it's possible with a join but just not sure how. I'

Re: JOIN - Which and how?

2008-12-03 Thread Ananda Kumar
did u try this select * from raw_materials where raw_mat_id not in (select raw_mat_id from raw_materials__Products); On 12/3/08, Nigel Peck <[EMAIL PROTECTED]> wrote: > > Hi all, > > I'm having trouble figuring out how to construct a query and am hoping > someone can help... > > I have three ta

JOIN - Which and how?

2008-12-03 Thread Nigel Peck
Hi all, I'm having trouble figuring out how to construct a query and am hoping someone can help... I have three tables: Raw_materials +++---+ | raw_mat_id | name | count | +++---+ | 1 |