I have a two table query where I want to return records from the first table
and if they have corresponding details in my second table I wish to return
those as well. A sample sql statement I am using is as follows:

select decheader.code, decheader.height, decheader.width,
decplacement.position, decplacement.product from decheader left join
decplacement on decheader.code = decplacement.code where (decheader.code =
'00007' and decplacement.product = 'OVRLCKBDG') or (decheader.code = '00006'
and decplacement.product = '1029106') or (decheader.code = '00005' and
decplacement.product = '1029103') or (decheader.code = '00005' and
decplacement.product = '1029104') or (decheader.code = '00005' and
decplacement.product = '1029105') or (decheader.code = '00005' and
decplacement.product = '1029106') or (decheader.code = '00004' and
decplacement.product = '1029104') or (decheader.code = '00004' and
decplacement.product = '1029105')

In the above example, all of the codes exist in the decheader table but only
code 00007 has a corresponding product in the decplacement table. I would
wish to return all the decheader details for the above codes and the
decplacement details for code 00007 as well. This statement actually only
gives me the details for code 0007 and nothing else. I should add that for
each record in the decheader table, there may be one, none or many records
in the decplacement table but I will only be interested in a specific one. I
hope this makes some sort of sense!!


****************************************************
This e-mail is intended for the recipient only and
may contain confidential information. If you are
not the intended recipient then you should reply
to the sender and take no further ation based
upon the content of the message.
Internet e-mails are not necessarily secure and
CCM Limited does not accept any responsibility
for changes made to this message. 
Although checks have been made to ensure this
message and any attchments are free from viruses
the recipient should ensure that this is the case.
****************************************************

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to