Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6693655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:00:32+00:00 2026-05-26T06:00:32+00:00

Basically I have product and several model s for those product s. Each model

  • 0

Basically I have product and several models for those products. Each model has a price.

This is what I intended to do:

Mark a product as featured, then have it’s title, description, number 1 image’s thumbnail and the price for the cheapest model

This is my current query:

SELECT
  product.title,
  product.url_name,
  product.description,
  price.price,
  image.thumbnail
FROM
  mps_contents AS product
  LEFT OUTER JOIN
    mps_contents AS image 
    ON
      image.page_id = product.content_id AND
      image.display_order = '1' AND
      image.resource_type = 'image'
  LEFT OUTER JOIN
    mps_contents AS model 
    ON
      product.content_id = model.page_id
  INNER JOIN
    mps_product_info AS price
    ON
      model.content_id = price.content_id
WHERE
  product.active = '1' AND
  product.resource_type = 'product' AND
  product.featured = '1'
ORDER BY RAND( )
LIMIT 3

You may see that my query cannot do the price sorting, I hope somebody could help me with that. An additional problem that I encounter is if I have multiple models for a product. I end up getting a set that has prices for 2 models from a single product when the intent is to have the 1 price for each product.

I am aware of the issue with ORDER BY RAND() but I will ignore it since I don’t think this site will have more that 50 products.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T06:00:32+00:00Added an answer on May 26, 2026 at 6:00 am

    I think something like this should work….

    SELECT
      product.title,
      product.url_name,
      product.description,
      A.price,
      image.thumbnail
    FROM
      mps_contents AS product
      LEFT OUTER JOIN
        mps_contents AS image 
        ON
          image.page_id = product.content_id AND
          image.display_order = '1' AND
          image.resource_type = 'image'
      LEFT OUTER JOIN (
          SELECT price.price 
          FROM mps_contents AS model 
          JOIN mps_product_info price ON (model.content_id = price.content_id) 
          WHERE model.page_id = product.content_id 
          ORDER BY price.price
          LIMIT 1
      ) AS A
    WHERE
      product.active = '1' AND
      product.resource_type = 'product' AND
      product.featured = '1'
    ORDER BY RAND( )
    LIMIT 3
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So this app is basically selling several products, users login to their account and
Basically have a table of products, something similar to: <table> <tr> <td>Product 1 <br>
In our product, we have frames that are basically three inheritance levels down from
I basically have a page which shows a processing screen which has been flushed
I basically have something like this: void Foo(Type ty) { var result = serializer.Deserialize<ty>(inputContent);
I basically have three tables, posts, images and postimages (this simply contains the ids
I've been struggling with this error for several days with little headway. Basically, I'm
We have a product we are deploying to some small businesses. It is basically
We have a web-based product that is used for project management and planning. Each
I have some code here: (It basically checks if a product is a kit

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.