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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T13:44:10+00:00 2026-06-08T13:44:10+00:00

I want to select all dealercode (distinct) and introducercode with iapn. Bbut iapn must

  • 0

DATA SETS

I want to select all dealercode (distinct) and introducercode with iapn. Bbut iapn must be a highest value only.

e.g.

dealercode = 7 and iapin = 3 and introducercode = 3 

like that (THIS MUST BE A ONLY VALUE FOR DEALERCODE)

This is my query:

  SELECT DISTINCT 
      dealercode, iapin as iapin,
      (SELECT introducercode) as introducecode
  FROM 
      dealerplacement d
  where 
      exists (SELECT MIN(iapin) FROM dealerplacement )
  ORDER BY 
      dealercode, iapin ASC 

I have attached with this post data set to this code.

enter image description here

This is the structure. I want to get result as below.
DEALERCODE 1200 iapn 003 and introducercode 203. only.

current database as below.

  1200  001  201
  1200  002  202
  1200  003  203

Please help me to solve 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-08T13:44:11+00:00Added an answer on June 8, 2026 at 1:44 pm

    Why not just use MAX and GROUP BY or is there something else I am missing

    SELECT  dealercode,
            introducercode,
            MAX(iapin) iapin
    FROM    dealerplacement d
    GROUP BY    dealercode,
                introducercode
    

    Aggregate Functions (Transact-SQL)

    EDIT

    Re the changes to your request, you might want to try something like

    SELECT  d.*
    FROM    dealerplacement d INNER JOIN
            (
                SELECT  dealercode, 
                        MAX(iapin) iapin 
                FROM    dealerplacement d 
                GROUP BY    dealercode
            ) dM    ON  d.dealercode = dM.dealercode
                    AND d.iapin = dM.iapin
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to select all distinct order_ids from my table, and order that list
I want to select all the select elements that have a value of -1
I want to select all elements that have an accesskey defined on them. I
I want to select all nodes <cci:p> that do not have an attribute. So,
I'm creating the MaskedTextBox in WP7.1 In that i want to select all text
Struggling with CSS selector. Want to select all FORM elements that are ancestors of
I want to select all the fields of one table, and only specifics fields
I want to select all items on a page that have a particular label
My table: _id | state | timeStamp I want select all the rows that
I want to select all the elements that have the two classes a and

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.