Jump to content

Ordering output when comparing items from 2 tables


Buchead

Recommended Posts

Hello,

Wondering if anyone can point me in the right direction. I have the following command:

"SELECT * FROM products_tree, products WHERE products_tree.sectionID = '$section' AND products.productID = products_tree.productID AND products.keywords LIKE '%$search%'"

It works ok. Checks the products_tree table for the given section number, and then retrieves the relevant data from products for the given productID and the keywords match the criteria. However I'd like to order the output by products.code as it's simply outputting in the order retrieve from the database.

I've added in an ORDER BY clause but that had no effect.

What am I doing wrong?

Thanks,

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