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 7922933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T17:08:25+00:00 2026-06-03T17:08:25+00:00

Can someone please help me in writing the exact query, which can give me

  • 0

Can someone please help me in writing the exact query, which can give me desired results for the following,

I wrote,

   SELECT tbl_order_detail.order_id, 
          tbl_order_detail.order_title, 
          tbl_order_detail.dealer_id
     FROM tbl_order_detail
LEFT JOIN tbl_order_lead_send_detail ON tbl_order_detail.order_id=tbl_order_lead_send_detail.order_id
    WHERE tbl_order_detail.order_status = 'Active'

and finding the dealer name from one php function that takes dealer_id in it and returns dealer_name (using another mysql query), and count from another mysql query

but it isn’t giving my desired output. it’s giving output as

But I want the above circled ones in one row only, as everything is same in them, but they are showing many times in the output (why not one).

Can someone help me in this?

  • 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-06-03T17:08:28+00:00Added an answer on June 3, 2026 at 5:08 pm

    If you GROUP BY order_id, you should be good to go

    Edit:

    To get the dealer name, just JOIN the dealer table and select the dealer name column.

    Untested, may contain errors

    SELECT
        tbl_order_detail.order_id, 
        tbl_order_detail.order_title, 
        dealer.dealer_name,
        COUNT(tbl_order_lead_send_detail.order_id) AS total_customers_count
    FROM tbl_order_detail
    JOIN dealers ON (tbl_order_detail.dealer_id = dealers.dealer_id)
    LEFT JOIN tbl_order_lead_send_detail ON (tbl_order_detail.order_id = tbl_order_lead_send_detail.order_id)
    WHERE tbl_order_detail.order_status = 'Active'
    GROUP BY tbl_order_detail.order_id, tbl_order_detail.order_title, dealer.dealer_name;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone please help me tune this SQL query? SELECT a.BuildingID, a.ApplicantID, a.ACH, a.Address,
Can someone please help me figure out a way to achieve the following (see
Hi can someone please help me in writing this regex. I need to search
Can someone please help to convert this to linq? SELECT x.contentobjectid, Min(x.city) as city,
Can someone please help me out with a query? In Microsoft SQL Server, I
can someone please help me out writing this code in objective C : function
Can someone please help me with the following code? The methods runs until ss.accept();
Can someone please help me figure out why my accordion script at http://www.mincovlaw.com/services/copyright gets
Can someone please help me out with printing the contents of an IFrame via
Can someone please help quickly mute or unmute the stage volume in Flash CS3

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.