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

  • Home
  • SEARCH
  • 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 5987729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:51:27+00:00 2026-05-22T22:51:27+00:00

hello master around the world, im here again with a problem :D now i

  • 0

hello master around the world, im here again with a problem 😀

now i wanna ask something simple for you but really I’m new on programming and sql, so need more learn.

ok, lets to the problem. I have some sql query like this

SELECT
eu_product.*,
eu_shop_display.display_name as dname,
eu_product_img.image_url as img
FROM eu_product
INNER JOIN eu_product_img on eu_product_img.product_id = eu_product.product_id
INNER JOIN eu_shop_display on eu_shop_display.display_id = eu_product.product_display
where eu_product.publish=1
and eu_product.shop_id=1
and eu_product.product_display IN (select display_id from eu_shop_display where parent_id=1) 
or eu_product.product_display = 1
GROUP BY eu_product.product_id 
ORDER BY eu_product.product_id DESC  LIMIT 0, 10

The problem is in

INNER JOIN eu_product_img on
eu_product_img.product_id =
eu_product.product_id

the table seen like this

enter image description here

I need to using Order ASC on field “listing”.

is SQL query can use two order by, or can adding order by in inner join ? i try adding

ORDER BY eu_product.product_id DESC, eu_product_img.listing ASC

but its not working 🙁

maybe someone can explain how its work.


UPDATE

.< maybe i’ll make simple query

this product table

enter image description here

this product_img table

enter image description here

and this a result

enter image description here

but the ” eu_product_img.listing ASC ” not run correctly 🙁

i need the listing on product_id 1 is 1 not 4

see the table product_img

i need run the product_img.listing order ASC first before joined it.

the correct query is like this

SELECT eu_product.product_id, 
(select img.listing from eu_product_img as img where img.product_id = eu_product.product_id order by img.listing ASC limit 1 ) as listing 
    FROM eu_product 
    where eu_product.shop_id=1 
    or eu_product.product_display = 2 
    GROUP BY eu_product.product_id 
    ORDER BY eu_product.product_id DESC  LIMIT 0, 20

so it cannot using inner join ?

thanks before.

Regard,
Stecy

  • 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-22T22:51:27+00:00Added an answer on May 22, 2026 at 10:51 pm

    It is working. You see from the screenshot that they are first ordered by product_id and then by listing. If you just want to order by listing, then do ORDER BY eu_product_img.listing ASC. If you want to order by listing then product, reverse your order by statements.

    Order by accepts multiple statements, but your results will be ordered in the order you specify the order statements 😉 So, if listing is first, results are ordered by listing first, etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

-Hello Sandeep here. I am an apprentice to the Jedi Master Yoda. My master
I'm trying to assemble a simple Hello world application with Masm32. It assembles fine
I'm building an application with the Dyninst API, and with a simple Hello World
<script> $(#test_img).click(function() { alert(Hello); }); </script> But it doesn't matter what mouse button I'm
Hello again ladies and gents! OK, following on from my other question on ASP.NET
Hello I am compiling a program with make but I get the error of
Getting started with jquery and having trouble getting hello world type example going for
I can get simple examples to work fine as long as there's no master
I'm semi-new to writing ASP.Net applications using master pages and I've run into an
VS2005, ASP.NET, C#, IIS6 Hello friends, I have a master page divided into three

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.