Putte,
Friday, November 08, 2002, 11:09:11 AM, you wrote:

PK> I have two tables wich I need to join together. I use INNER JOIN but there
PK> is one problem.
PK> I have a master table, where is a column where I have a WHERE clause, wich I
PK> use as criterion for SELECT.
PK> The second table has some details for rows, wich fulfil the WHERE clause.
PK> I have an ID for rows, wihc are the same in both tables.

PK> Problem is, that if I remove a row from secondary table, it does not come to
PK> query results any more,
PK> and I need to have all rows from master table even if there is no rows in
PK> secondary table.

You sould use LEFT JOIN instead of INNER JOIN, like:

SELECT ... FROM master_table AS mt LEFT JOIN secondary_table AS st ON
mt.id=st.id ...


-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Victoria Reznichenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
       <___/   www.mysql.com





---------------------------------------------------------------------
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