Use:

tabProds LEFT JOIN tabUsers ON tabProds.usr_ID = tabUsers.usr_ID

from  the manual:
If there is no matching record for the right table in the |ON| or 
|USING| part in a |LEFT JOIN|, a row with all columns set to |NULL| is 
used for the right table.

Jorge Garza wrote:

>Hi
>
>I'm designing 2 tables, where tabProds has the foreign key of tabUsers.
>So when I want to join them I use..
>WHERE tabProds.usr_ID = tabUsers.usr_ID
>
>Ok
>
>But the thing is that sometimes will not be possible to specify a user when
>you insert a Product(becaouse we don't know at that time)...
>And I'm anticipating the query mentioned above would not display the
>products that doesn't match any user's ID, AND I want those records to be
>showed too.
>Would be like this...?
>WHERE (tabProds.usr_ID = tabUsers.usr_ID) or (tabProd.usr_ID= Null)
>
>But, with this query, what is going to show on the User's columns when it
>gets a Null field..?
>
>ProdID   UserID  UserName
>23            2            John
>34            Null        ?      <----------- What's going to happen here..?
>45            4            Pedro
>
>Or is there anohter options..? like Left joins.. and all that, (I haven't
>analize them yet)
>
>I know you may think... "Well do the test and see it", well yes, is just
>that affects the way I'm thinking to design the web system, and I would like
>to know when I'm on the DB design and before the programming
>
>Thank you
>
>jgarza
>
>
>
>
>---------------------------------------------------------------------
>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
>
>  
>



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