Results 1 to 10 of 18

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Eastern US
    Posts
    488
    Plugin Contributions
    0

    Default Re: Need help w/ SQL query in phpMyAdmin



    Hmmm, can anyone tell me what is wrong w/ this:
    Code:
    SELECT products_description.products_name, products_description.products_description, products_description.products_id, products.products_image, products.products_price_sorter
    FROM products_description, products
    WHERE products.products_status = "1"
    This gives me the same name, description and id attached to each different image, price_sorter, then the next name, description and id attached to each different image, price_sorter, then the next, etc.

    Thanks for any help! I'm off to bed for now.
    Audra

  2. #2
    Join Date
    Apr 2004
    Location
    vienna
    Posts
    198
    Plugin Contributions
    9

    Default Re: Need help w/ SQL query in phpMyAdmin

    Quote Originally Posted by audradh View Post


    Hmmm, can anyone tell me what is wrong w/ this:
    Code:
    SELECT products_description.products_name, products_description.products_description, products_description.products_id, products.products_image, products.products_price_sorter
    FROM products_description, products
    WHERE products.products_status = "1"
    try this one
    Code:
    SELECT products_description.products_name, products_description.products_description, products_description.products_id, products.products_image, products.products_price_sorter
    FROM products_description INNER JOIN products ON products_description.products_id = products.products_id
    WHERE products.products_status=1
    you have forgot the join statement :: http://dev.mysql.com/doc/refman/5.0/en/join.html

  3. #3
    Join Date
    Oct 2005
    Location
    Eastern US
    Posts
    488
    Plugin Contributions
    0

    Default Re: Need help w/ SQL query in phpMyAdmin

    Worked a charm, thanks hugo!

    I'll have to really look at Join Statements. That might take me a little bit to digest.

    I have managed to expand it to find only the products on special by doing this:
    Code:
    SELECT products_description.products_name, products_description.products_description, products_description.products_id, products.products_image, products.products_price_sorter
    FROM products_description
    INNER JOIN (
    products, specials
    ) ON ( products_description.products_id = products.products_id
    AND specials.status = "1"
    AND products_description.products_id = specials.products_id )
    WHERE products.products_status =1
    Now to pull products on sale, must be similar but using master category ids.

    And lastly to pull everything not on sale/special, hmmm, not sure how that will work. Any thoughts?

  4. #4
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,266
    Plugin Contributions
    3

    Default Re: Need help w/ SQL query in phpMyAdmin

    All this would be easier if you used phpMyAdmin...
    20 years a Zencart User

  5. #5
    Join Date
    Oct 2005
    Location
    Eastern US
    Posts
    488
    Plugin Contributions
    0

    Default Re: Need help w/ SQL query in phpMyAdmin

    Funny, I actually am doing this in phpMyAdmin, but I'm not familiar w/ using the query tab either and couldn't seem to find what I wanted. Either way had a learning curve for me, but now that I've gotten this far I can see that the join portion might have been easier that way...but then I wouldn't have learned as much! Perhaps it will help me w/ this next portion though.

    Thanks
    Audra

  6. #6
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,266
    Plugin Contributions
    3

    Default Re: Need help w/ SQL query in phpMyAdmin

    Apologies Audradh... I see that you are using phpMyAdmin... why not just use the EXPORT features there?

    ... or is the export you want more specific and custom?
    20 years a Zencart User

  7. #7
    Join Date
    Oct 2005
    Location
    Eastern US
    Posts
    488
    Plugin Contributions
    0

    Default Re: Need help w/ SQL query in phpMyAdmin

    Yes, I'm trying to pull only specific information for a data feed, so I don't think the Export tab will give me what I am looking for.

 

 

Similar Threads

  1. v151 Need some help building a looping SQL query to fill an array.
    By Chris Stackhouse in forum General Questions
    Replies: 2
    Last Post: 3 Sep 2015, 08:19 PM
  2. v139h Save the Multi Table Query Result in phpmyadmin or by SQL CLI
    By explorer1979 in forum General Questions
    Replies: 2
    Last Post: 31 Dec 2013, 09:03 PM
  3. Need help creating SQL query...
    By DigitalShadow in forum General Questions
    Replies: 2
    Last Post: 22 Jun 2011, 02:05 PM
  4. Need help with SQL query. Want to make membership that expires.
    By TecBrat in forum Managing Customers and Orders
    Replies: 1
    Last Post: 18 Jun 2010, 03:43 PM
  5. Specifying 'Product priced by attributes' by running phpmyadmin SQL query?
    By vandiermen in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 2 Aug 2009, 06:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg