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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:24:25+00:00 2026-06-12T21:24:25+00:00

Here goes my table values. ( 7 Records ) SELECT * FROM tbl1 I

  • 0

Here goes my table values. ( 7 Records )

SELECT * FROM tbl1

I can’t post the image as my rep is low. So i am linking it here
https://i.stack.imgur.com/CFl0u.png

I wrote a query to avoid the last record, but i am still getting the last record. (ALL I NEED IS DISTINCT EMAILS)

SELECT DISTINCT CandEmail,CandName,EmployerId,ContNum,IsDeleted,CandPortalId FROM tbl1
WHERE EmployerId = 7 AND IsDeleted = 0

The above query still retrieves the same 7 records with last duplicate email record.

  • 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-12T21:24:26+00:00Added an answer on June 12, 2026 at 9:24 pm

    If you do not care which ContNum you get, then you can place an aggregate function around that field and then GROUP BY the rest:

    SELECT CandEmail,
      CandName,
      EmployerId,
      MIN(ContNum) ContNum,  -- or you can use MAX()
      IsDeleted,
      CandPortalId 
    FROM tbl1
    WHERE EmployerId = 7 
      AND IsDeleted = 0
    GROUP BY CandEmail,
      CandName,
      EmployerId, 
      IsDeleted,
      CandPortalId 
    

    Or as others have pointed out, you should use aggregate functions on the other fields as well, unless you know for sure there are not different values in those columns:

    SELECT CandEmail,
      min(CandName) CandName,
      min(EmployerId) EmployerId,
      MIN(ContNum) ContNum,  -- or you can use MAX()
      min(IsDeleted) IsDeleted,
      min(CandPortalId) CandPortalId
    FROM tbl1
    WHERE EmployerId = 7 
      AND IsDeleted = 0
    GROUP BY CandEmail
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok here goes: I have a table with id ( can be duplicate but
Weird to describe but here goes. I have a table with several rows. One
Ok here goes: I have a SELECT drop down option with US state names
Here goes, second post, first didn't go to well.... I am calling an SP
I'm guessing this isn't possible, but here goes. I have two tables, and I'm
Ok here goes. This is my first ever wicket application and I'm trying to
I had much luck last time I submitted a question so here goes: I
I'm sure the answer is somehow logical but here goes. I have three big
Ok, first question so here goes, A function that runs on activation of a
A slightly archaic question I'm afraid but here goes: I have a program which

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.