Jump to content

Left Outer Join


RON_ron

Recommended Posts

I'll getting data from two different databses. Code A is the current code (works well). After doing some modifications (Code B), now the code outputs nothing . Could someone help to correct the error in Code B?

 

Code A

 

$query = "SELECT * FROM furniture LEFT OUTER JOIN furnitureBrands ON furniture.itemCode = furnitureBrands.theName ORDER BY furniture.key DESC;
$results = mysql_query($query);

 

Code B

$query = "SELECT * FROM furniture LEFT OUTER JOIN furnitureBrands ON furniture.itemCode = furnitureBrands.theName WHERE furniture.checked = '0', furniture.availability = 'yes' ORDER BY furniture.key DESC;
$results = mysql_query($query);

 

Thanks.

Link to comment
Share on other sites

A look at the value of mysql_error() helps in these circumstance.

 

Do that,then try

 

$query = "SELECT * FROM furniture
 LEFT OUTER JOIN furnitureBrands ON furniture.itemCode = furnitureBrands.theName
WHERE furniture.checked = '0'
 AND furniture.availability = 'yes'
ORDER BY furniture.key DESC";

Edited by Barand
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.