Results 1 to 10 of 12

Hybrid View

  1. #1
    Join Date
    May 2008
    Posts
    7
    Plugin Contributions
    0

    Default Re: Custom inventory query statement - Need help please

    If I understand the problem, try adding "GROUP BY products_id" between the WHERE and ORDER clauses. I don't have any linked products in my database to test this with, so all bets are off here.

    You should end up with something like this:

    WHERE products_status =1
    GROUP BY products_id
    ORDER BY products_last_modified DESC

  2. #2
    Join Date
    Sep 2004
    Location
    Murfreesboro, TN
    Posts
    588
    Plugin Contributions
    0

    Default Re: Custom inventory query statement - Need help please

    AndyM;

    I tried this and here is what came back:

    #1052 - Column: 'products_id' in group statement is ambiguous

    And here is what the query now looks like:

    SELECT CONCAT('http://', products_url) "Product Url", products_name "Product Name", products_description "Product Description", CONCAT( 'http://www.swansoninc.com/images/', products_image ) "Image URL", categories_name "Product Category", products_price "Product Price"
    FROM zen_products_description
    JOIN zen_products
    USING ( products_id )
    JOIN zen_products_to_categories
    USING ( products_id )
    JOIN zen_categories
    USING ( categories_id )
    JOIN zen_categories_description
    USING ( categories_id )
    WHERE products_status =1
    GROUP BY products_id
    ORDER BY products_last_modified DESC

    Also since it was never mentioned I am on a server that is running MySQL 4.0.26. Please make sure any post replies refer to MySQL 4, not version 5.

    thanks...

    0be1
    "Give me one hundred preachers who fear nothing but sin and desire nothing but God, and I care not whether they be clergymen or laymen, they alone will shake the gates of Hell and set up the kingdom of Heaven upon Earth." - John Wesley

  3. #3
    Join Date
    May 2008
    Posts
    7
    Plugin Contributions
    0

    Default Re: Custom inventory query statement - Need help please

    None of this should be specific to 5. It's pretty generic SQL.

    Try using GROUP BY zen_products.products_id instead. MySQL can't figure out which products_id you mean (even though they're JOINed and should be the same anyway).

  4. #4
    Join Date
    Sep 2004
    Location
    Murfreesboro, TN
    Posts
    588
    Plugin Contributions
    0

    Default Re: Custom inventory query statement - Need help please

    AndyM;

    That Worked!!! Thank you soooooooooo much. I do have another question. Do you ever sleep (LOL). Now if I can just figure out why my data is trashed on the output I will be good to go.

    Thanks again...

    0be1
    "Give me one hundred preachers who fear nothing but sin and desire nothing but God, and I care not whether they be clergymen or laymen, they alone will shake the gates of Hell and set up the kingdom of Heaven upon Earth." - John Wesley

  5. #5
    Join Date
    May 2008
    Posts
    7
    Plugin Contributions
    0

    Default Re: Custom inventory query statement - Need help please

    I'm glad the query worked.

    I do sleep, just not as much as I'd like to.

 

 

Similar Threads

  1. Table query is not working. Need some help please.
    By southshorepizza in forum General Questions
    Replies: 47
    Last Post: 21 Nov 2014, 02:20 AM
  2. Need Help With If Statement For Displaying Images
    By games4gamers in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 7 Apr 2010, 07:29 PM
  3. adding php statement ! please help
    By gentmat in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 11 Apr 2009, 06:36 PM
  4. Help writing a custom SQL query please
    By bodyjewelrystores in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 6 Feb 2008, 03:08 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